-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #629 from ChicagoWorldcon/staging
2.0.0
- Loading branch information
Showing
42 changed files
with
995 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class PublicationDatesController < ResourceController | ||
SERIALIZER_CLASS = 'PublicationDateSerializer'.freeze | ||
POLICY_CLASS = 'PublicationDatePolicy'.freeze | ||
POLICY_SCOPE_CLASS = 'PublicationDatePolicy::Scope'.freeze | ||
DEFAULT_SORTBY = 'timestamp' | ||
DEFAULT_ORDER = 'desc'.freeze | ||
|
||
def reset | ||
# Make sure that people can not publish etc while we clean up | ||
PublicationStatus.last.update(status: 'inprogress') | ||
|
||
# Get rid of published data first | ||
PublishedSession.destroy_all | ||
|
||
# Then get rid of the audit | ||
Audit::PublishedSessionVersion.delete_all | ||
|
||
# Then remove caches, dates, and status | ||
PublishSnapshot.delete_all | ||
PublicationDate.delete_all | ||
PublicationStatus.delete_all | ||
|
||
render status: :ok, | ||
json: { message: 'publication reset' }.to_json, | ||
content_type: 'application/json' | ||
end | ||
|
||
def paginate | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
class Reports::ProgramOpsReportsController < ApplicationController | ||
around_action :set_timezone | ||
|
||
def back_of_badge | ||
authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy | ||
|
||
assignments = PublishedSessionAssignment | ||
.includes(:person, :session_assignment_role_type, :published_session) | ||
.order("people.published_name, published_sessions.start_time asc") | ||
|
||
|
||
workbook = FastExcel.open #(constant_memory: true) | ||
worksheet = workbook.add_worksheet("Back of Badge") | ||
date_time_style = workbook.number_format(EXCEL_NBR_FORMAT) | ||
|
||
worksheet.append_row([]) # For the header | ||
|
||
group_assignments = assignments.group_by {|a| a.person} | ||
max_sessions = 0 | ||
group_assignments.each do |person, grouped| | ||
row = [ | ||
person.published_name | ||
] | ||
styles = [nil] | ||
|
||
grouped.each do |assignment| | ||
row.concat [ | ||
assignment.session.title, | ||
assignment.session.start_time ? FastExcel.date_num(assignment.session.start_time, assignment.session.start_time.in_time_zone.utc_offset) : nil, | ||
"#{assignment.session.duration} mins", | ||
assignment.session.room&.name, | ||
] | ||
styles.concat [ | ||
nil, date_time_style, nil, nil | ||
] | ||
end | ||
max_sessions = grouped.size if grouped.size > max_sessions | ||
|
||
worksheet.append_row(row, styles) | ||
end | ||
|
||
header = ['Published Name'] | ||
(0..max_sessions).each do |n| | ||
header.concat ["Title #{n+1}", "Start Time #{n+1}", "Duration #{n+1}", "Room #{n+1}"] | ||
end | ||
worksheet.write_row(0, header) | ||
|
||
send_data workbook.read_string, | ||
filename: "BackOfBadge-#{Time.now.strftime('%m-%d-%Y')}.xlsx", | ||
disposition: 'attachment' | ||
end | ||
end |
Oops, something went wrong.