Skip to content

Instantly share code, notes, and snippets.

@rob-race
Created October 9, 2017 20:30
Show Gist options
  • Save rob-race/3960f9416d229a33eb00dee220521f29 to your computer and use it in GitHub Desktop.
Save rob-race/3960f9416d229a33eb00dee220521f29 to your computer and use it in GitHub Desktop.
build_and_create_standup(
user: user,
tasks: tasks_from_body,
date: today,
message_id: email.headers["Message-ID"]
)
end
private
def build_and_create_standup(user:, tasks:, date:, message_id:)
standup = Standup.new(
user_id: user.id,
standup_date: date,
message_id: message_id
)
tasks.each do |task|
task_type, task_body = task.first.scan(/(\[[dtb]\])(.*)$/).flatten
standup.tasks << Task.new(type: TASK_TYPE_HASH[task_type], title: task_body)
end
standup.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment