Skip to content

Commit

Permalink
Merge pull request #646 from ChicagoWorldcon/stag-fix-report-bugs
Browse files Browse the repository at this point in the history
handle case of new scheduled sessions (2.0.1)
  • Loading branch information
Gailbear authored Aug 18, 2022
2 parents 831e15f + e362f57 commit 2dcdedd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions app/controllers/reports/schedule_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,22 @@ def session_added_row(sheet, change)
moderator = SessionAssignmentRoleType.find_by(name: 'Moderator')
participant = SessionAssignmentRoleType.find_by(name: 'Participant')

# If this is Session and it is added then so are the people
object = change[:object]
# If it is an add and we have the reify before the time and room get the latest version of the object
if !change[:object].start_time || !change[:object].room_id
object = change[:item_type].constantize.find change[:item_id].id
end

sheet.append_row(
[
change[:object].title,
change[:object].description,
change[:object].format&.name,
change[:object].areas.collect(&:name).join("; "),
FastExcel.date_num(change[:object].start_time, change[:object].start_time.in_time_zone.utc_offset),
change[:object].room&.name,
change[:object].participant_assignments.where("session_assignment_role_type_id = ?", moderator).collect{|a| a.person.published_name}.join("; "),
change[:object].participant_assignments.where("session_assignment_role_type_id = ?", participant).collect{|a| a.person.published_name}.join("; ")
object.title,
object.description,
object.format&.name,
object.areas.collect(&:name).join("; "),
FastExcel.date_num(object.start_time, object.start_time.in_time_zone.utc_offset),
object.room&.name,
object.participant_assignments.where("session_assignment_role_type_id = ?", moderator).collect{|a| a.person.published_name}.join("; "),
object.participant_assignments.where("session_assignment_role_type_id = ?", participant).collect{|a| a.person.published_name}.join("; ")
],
[
nil, nil, nil, nil, @date_time_style, nil, nil, nil
Expand Down
2 changes: 1 addition & 1 deletion app/services/change_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def self.get_changes(clazz:, type:, from:, to:, publishable_session_ids: nil)
if publishable_session_ids
next unless publishable_session_ids.include?(obj.session_id)
end
changes[key] = {item_id: audit.item_id, event: audit.event, object: obj, changes: audit.object_changes}
changes[key] = {item_id: audit.item_id, item_type: audit.item_type, event: audit.event, object: obj, changes: audit.object_changes}
end
end
end
Expand Down

0 comments on commit 2dcdedd

Please sign in to comment.