Class: Lita::Standups::Models::StandupSession
- Includes:
- Ohm::Callbacks, Ohm::DataTypes, Ohm::Timestamps
- Defined in:
- lib/lita/standups/models/standup_session.rb
Instance Method Summary collapse
- #before_create ⇒ Object
- #description ⇒ Object
- #report_message ⇒ Object
- #summary ⇒ Object
- #update_status ⇒ Object
Methods inherited from Base
Instance Method Details
#before_create ⇒ Object
27 28 29 30 |
# File 'lib/lita/standups/models/standup_session.rb', line 27 def before_create self.status = 'pending' self.results_sent = "0" end |
#description ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/lita/standups/models/standup_session.rb', line 58 def description = ["ID: #{id}"] << "Standup: #{standup.name}" << "Date: #{created_at.strftime('%c')}" << "Total recipients: #{counts['total']}" << "Total finished: #{counts['finished']}" .join("\n") end |
#report_message ⇒ Object
50 51 52 |
# File 'lib/lita/standups/models/standup_session.rb', line 50 def standup_responses.map(&:report_message).join("\n") end |
#summary ⇒ Object
54 55 56 |
# File 'lib/lita/standups/models/standup_session.rb', line 54 def summary "ID: #{id} - standup #{standup.name} ran on #{created_at.strftime('%c')}" end |
#update_status ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lita/standups/models/standup_session.rb', line 38 def update_status counts = { 'total' => 0, 'finished' => 0 } standup_responses.each do |r| counts[r.status] = counts[r.status].to_i + 1 counts['total'] = counts['total'] + 1 counts['finished'] = counts['finished'] + 1 if r.finished? end self.counts = counts completed! if counts['total'] == counts['finished'] save end |