-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Roster report download, first pass
Issue #301: Built-in report pages, to replace dependency on external query dashboards.
- Loading branch information
Frank Duncan
committed
Feb 21, 2021
1 parent
e6fd466
commit ec6dd41
Showing
3 changed files
with
36 additions
and
2 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,32 @@ | ||
<%- headers = ['Name', 'Positions', 'Num Shifts', 'Prev Shift', 'Next Shift', 'Last Login', 'Flex Schedule'] -%> | ||
<%= CSV.generate_line headers -%> | ||
<%- collection.each do |person| | ||
d = prev_shift(person) | ||
if d | ||
prev_shift = "#{d.to_s :dow_short} (#{(Date.current-d).to_i} days ago)" | ||
else | ||
prev_shift = "" | ||
end | ||
d = next_shift(person) | ||
if d | ||
next_shift = d.to_s :dow_short | ||
else | ||
next_shift = "" | ||
end | ||
d = person.last_login | ||
if d | ||
last_login = d.to_s :dow_short | ||
else | ||
last_login = "" | ||
end | ||
positions = person.positions.select{|p|!p.hidden}.map(&:name).join ", " | ||
-%> | ||
<%= CSV.generate_line([person.full_name, | ||
positions, | ||
pluralize(num_shifts(person), 'shift'), | ||
prev_shift, | ||
next_shift, | ||
last_login, | ||
flex_schedule_for(person.id).try(:num_shifts) | ||
]).html_safe -%> | ||
<%- 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