Skip to content

Commit

Permalink
Merge pull request #1021 from PlanoramaEvents/plan-904-add-tags-to-re…
Browse files Browse the repository at this point in the history
…ports

Plan-904 add tags and labels to reports
  • Loading branch information
Gailbear authored Apr 21, 2024
2 parents 2bae057 + ee0fd03 commit fbf4c22
Show file tree
Hide file tree
Showing 13 changed files with 281 additions and 311 deletions.
8 changes: 6 additions & 2 deletions app/controllers/reports/people_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def moderators
'Participant Status',
'Session Name',
'Session Format',
'Session Environment'
'Session Environment',
'Tags',
'Admin Labels'
]
)

Expand All @@ -135,7 +137,9 @@ def moderators
person.con_state,
session.title,
session.format&.name,
session.environment
session.environment,
session.tag_list.collect(&:name).join("; "),
session.label_list.collect(&:name).join("; "),
]
)
end
Expand Down
13 changes: 9 additions & 4 deletions app/controllers/reports/program_ops_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def session_minors
worksheet.append_row(
[
'Session',
'Tags',
'Admin Labels',
'Description',
'Start Time',
'Room',
Expand All @@ -75,6 +77,8 @@ def session_minors
worksheet.append_row(
[
session.title,
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.description,
session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil,
session.room&.name,
Expand Down Expand Up @@ -154,15 +158,16 @@ def room_signs

sessions.sort{|a,b| a.start_time <=> b.start_time}.each do |session|
row.concat [
# session.start_time.strftime('%A'),
session.title,
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil,
ActionView::Base.full_sanitizer.sanitize(session.description),
session.published_session_assignments.select{|a| a.session_assignment_role_type_id == moderator.id}.collect{|a| a.person.published_name}.join("; "),
session.published_session_assignments.select{|a| a.session_assignment_role_type_id == participant.id}.collect{|a| a.person.published_name}.join("; "),
]
styles.concat [
nil, date_time_style, nil, nil, nil
nil, nil, nil, date_time_style, nil, nil, nil
]
end
max_sessions = sessions.size if sessions.size > max_sessions
Expand All @@ -171,8 +176,8 @@ def room_signs
end

header = ['Room', 'Day']
(0..max_sessions).each do |n|
header.concat ["Title #{n+1}", "Start Time #{n+1}", "Description #{n+1}", "Moderators #{n+1}", "Participants #{n+1}"]
(1..max_sessions).each do |n|
header.concat ["Title #{n+1}", "Tags #{n+1}", "Admin Labels #{n+1}", "Start Time #{n+1}", "Description #{n+1}", "Moderators #{n+1}", "Participants #{n+1}"]
end
worksheet.write_row(0, header)

Expand Down
69 changes: 46 additions & 23 deletions app/controllers/reports/session_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def session_needs
'Environment',
'Format',
'Areas',
'Tags',
'Admin Labels',
'Required Room Features/Services', #room_notes
'Tech/Hotel Notes', #
'Room Setup' # room_set_id
Expand All @@ -38,6 +40,8 @@ def session_needs
session.environment,
session.format&.name,
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.room_notes,
session.tech_notes,
session.room_set&.name
Expand Down Expand Up @@ -71,7 +75,9 @@ def streamed_and_recorded
'Format',
'Environment',
'Livestreamed',
'Recorded'
'Recorded',
'Tags',
'Admin Labels'
]
)

Expand All @@ -84,7 +90,9 @@ def streamed_and_recorded
session.format&.name,
session.environment,
session.streamed ? 'Yes' : 'No',
session.recorded ? 'Yes' : 'No'
session.recorded ? 'Yes' : 'No',
session.tags_array&.join("; "),
session.labels_array&.join("; ")
],
styles
)
Expand Down Expand Up @@ -112,6 +120,8 @@ def daily_grid
'Session',
'Areas',
'Format',
'Tags',
'Admin Labels',
'Start Time',
'Duration',
'Room'
Expand All @@ -123,6 +133,8 @@ def daily_grid
[
session.title,
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.format&.name,
session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil,
session.duration,
Expand Down Expand Up @@ -150,6 +162,8 @@ def session_copy_edit_status
'Session',
'Description',
'Areas',
'Tags',
'Labels',
'Status',
'Copy Edited',
'Scheduled',
Expand All @@ -163,6 +177,8 @@ def session_copy_edit_status
session.title,
session.description, # NOTE: there is no mechanism for format HTML for excel so put the desc in and see what happens
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.status,
session.proofed ? 'Y' : 'N',
session.start_time && session.room_id ? 'Y' : 'N',
Expand All @@ -179,7 +195,7 @@ def session_copy_edit_status
def assigned_sessions_not_scheduled
authorize SessionAssignment, policy_class: Reports::SessionReportPolicy

sessions = ReportsService.assigned_sessions_not_scheduled
sessions = SessionService.assigned_sessions_not_scheduled

workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Assigned Session not Sched")
Expand All @@ -188,6 +204,8 @@ def assigned_sessions_not_scheduled
[
'Session',
'Areas',
'Tags',
'Admin Labels',
'Moderators',
'Participants',
'Invisible',
Expand All @@ -202,6 +220,8 @@ def assigned_sessions_not_scheduled
[
session.title,
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.session_assignments.select{|a| a.session_assignment_role_type_id == moderator.id}.collect{|a| a.person.published_name}.join(';'),
session.session_assignments.select{|a| a.session_assignment_role_type_id == participant.id}.collect{|a| a.person.published_name}.join(';'),
session.session_assignments.select{|a| a.session_assignment_role_type_id == invisible.id}.collect{|a| a.person.published_name}.join(';')
Expand Down Expand Up @@ -230,6 +250,8 @@ def scheduled_session_no_people
[
'Session',
'Area',
'Tags',
'Admin Labels',
'Start Time',
'Room'
]
Expand All @@ -240,6 +262,8 @@ def scheduled_session_no_people
[
session.title,
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil,
session.room.name
],
Expand Down Expand Up @@ -268,6 +292,8 @@ def session_with_no_moderator
[
'Session',
'Area',
'Tags',
'Admin Labels',
'Start Time',
'Format',
'People Assigned',
Expand All @@ -283,6 +309,8 @@ def session_with_no_moderator
[
session.title,
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil,
session.format&.name,
session.session_assignments.select{|a| a.session_assignment_role_type_id == participant.id}.collect{|a| a.person.published_name}.join(';'),
Expand All @@ -300,24 +328,7 @@ def session_with_no_moderator
def non_accepted_on_schedule
authorize SessionAssignment, policy_class: Reports::SessionReportPolicy

conflicts_table = ::PersonSchedule.arel_table
subquery = Session.area_list.as('areas_list')

joins = [
conflicts_table.create_join(
subquery,
conflicts_table.create_on(
subquery[:session_id].eq(conflicts_table[:session_id])
),
Arel::Nodes::OuterJoin
)
]

people_sessions = PersonSchedule.select(
::PersonSchedule.arel_table[Arel.star],
'areas_list.area_list'
)
.joins(joins)
people_sessions = SessionService.person_schedule
.where("session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("con_state not in ('not_set', 'accepted')")
.where("start_time is not null and room_id is not null")
Expand All @@ -332,7 +343,9 @@ def non_accepted_on_schedule
'Published Name',
'Participant Status',
'Session',
'Area'
'Area',
'Tags',
'Admin Labels'
]
)

Expand All @@ -343,7 +356,9 @@ def non_accepted_on_schedule
sa.published_name,
sa.con_state,
sa.title,
sa.area_list.join('; ')
sa.area_list.join('; '),
sa.tag_list.join("; "),
sa.label_list.join("; "),
]
)
end
Expand Down Expand Up @@ -484,6 +499,8 @@ def panels_with_too_few_people
[
'Session',
'Areas',
'Tags',
'Admin Labels',
'Start Time',
'Participant Count',
'Participant Count Lower Bound',
Expand All @@ -499,6 +516,8 @@ def panels_with_too_few_people
[
session.title,
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : '',
session.nbr_assignments,
3,
Expand Down Expand Up @@ -531,6 +550,8 @@ def panels_with_too_many_people
[
'Session',
'Areas',
'Tags',
'Admin Labels',
'Start Time',
'Participant Count',
'Participant Count Upper Bound',
Expand All @@ -547,6 +568,8 @@ def panels_with_too_many_people
[
session.title,
session.area_list.sort.join(';'),
session.tags_array&.join("; "),
session.labels_array&.join("; "),
session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil,
session.nbr_assignments,
6,
Expand Down
Loading

0 comments on commit fbf4c22

Please sign in to comment.