5
11
Fork
You've already forked tomato
1

Add occurrence time range to filter #128

Merged
edwardloveall merged 2 commits from el-shift-date-range into main 2026年03月26日 21:40:28 +01:00

It can be useful for org admins to see more than one week's worth of shift
occurrences. For example to look farther into the future to see when shifts need
to be filled, or to audit a site or volunteer over a few months. The current
single week view is pretty limiting.

This adds a start and end time to the shift filter that allows someone to pick
start and end date. The filter now sets the time range instead of the
controller. This also allows us to add some methods to the filter which let us
cleanly set a url to navigate back and forward through the window of shifts.

I tried at first to move the timeline inside the shift filter, but to make a
timeline requires a list of shifts, users, or an organization. That parameter
would get passed to the filter, which would then mean there are extra attributes
that had nothing to do with the filter. An org is the most minimal thing to
pass, but we can't allow someone to enter an org id in the url to see data from
other orgs. In addition to the security risk and a broken abstraction, it would
also complicate how we turn the filter into params.

I also put a max duration on the filter so someone doesn't accidentally or on
purpose overload the server. If there are any other filters, the max range is 1
year. If there are no filters, the max duration is 4 months.

new filter

It can be useful for org admins to see more than one week's worth of shift occurrences. For example to look farther into the future to see when shifts need to be filled, or to audit a site or volunteer over a few months. The current single week view is pretty limiting. This adds a start and end time to the shift filter that allows someone to pick start and end date. The filter now sets the time range instead of the controller. This also allows us to add some methods to the filter which let us cleanly set a url to navigate back and forward through the window of shifts. I tried at first to move the timeline inside the shift filter, but to make a timeline requires a list of shifts, users, or an organization. That parameter would get passed to the filter, which would then mean there are extra attributes that had nothing to do with the filter. An org is the most minimal thing to pass, but we can't allow someone to enter an org id in the url to see data from other orgs. In addition to the security risk and a broken abstraction, it would also complicate how we turn the filter into params. I also put a max duration on the filter so someone doesn't accidentally or on purpose overload the server. If there are any other filters, the max range is 1 year. If there are no filters, the max duration is 4 months. ![new filter](/attachments/31f5df9e-ed49-4f55-9452-6395a2a116a2)
Add occurrence time range to filter
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
d102606620
It can be useful for org admins to see more than one week's worth of shift
occurrences. For example to look farther into the future to see when shifts need
to be filled, or to audit a site or volunteer over a few months. The current
single week view is pretty limiting.
This adds a start and end time to the shift filter that allows someone to pick
start and end date. The filter now sets the time range instead of the
controller. This also allows us to add some methods to the filter which let us
cleanly set a url to navigate back and forward through the window of shifts.
I tried at first to move the timeline inside the shift filter, but to make a
timeline requires a list of shifts, users, or an organization. That parameter
would get passed to the filter, which would then mean there are extra attributes
that had nothing to do with the filter. An org is the most minimal thing to
pass, but we can't allow someone to enter an org id in the url to see data from
other orgs. In addition to the security risk and a broken abstraction, it would
also complicate how we turn the filter into params.
I also put a max duration on the filter so someone doesn't accidentally or on
purpose overload the server. If there are any other filters, the max range is 1
year. If there are no filters, the max duration is 4 months.
@ -205,0 +205,4 @@
.field-hint--description {
color: var(--color--text-alt);
grid-column: 1 / span 3;
margin-block-start: 0;
First-time contributor
Copy link

TIL about margin-block-start

TIL about `margin-block-start`
@ -21,0 +19,4 @@
# Hard caps the duration so we don't overload the server
if attributes.except("starts_at", "ends_at").values.none?(&:presence)
if (ends_at - starts_at) > MAX_DURATION_WITHOUT_FILTER
self.ends_at = starts_at + MAX_DURATION_WITHOUT_FILTER
First-time contributor
Copy link

If the ends_at value get's rewritten by the server does this show up in the UI?

EDIT: Reading below I believe the answer is yes, the only nice-to-have might be a little indicator or text when a user selected date gets changed by the server

If the ends_at value get's rewritten by the server does this show up in the UI? EDIT: Reading below I believe the answer is yes, the only nice-to-have might be a little indicator or text when a user selected date gets changed by the server
Author
Owner
Copy link

Yeah, it's not perfect. I ran out of time on the task so I think this is what we have for now and we might revisit in the future.

Yeah, it's not perfect. I ran out of time on the task so I think this is what we have for now and we might revisit in the future.
edwardloveall force-pushed el-shift-date-range from d102606620
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
to 868e7883e6
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
2026年03月25日 15:17:29 +01:00
Compare
edwardloveall force-pushed el-shift-date-range from 868e7883e6
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
to 501fd472f0
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
2026年03月26日 21:00:28 +01:00
Compare
edwardloveall deleted branch el-shift-date-range 2026年03月26日 21:40:29 +01:00
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rootable/tomato!128
Reference in a new issue
rootable/tomato
No description provided.
Delete branch "el-shift-date-range"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?