Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule Page Logic #57

Merged
merged 17 commits into from
Feb 12, 2025
Merged

Schedule Page Logic #57

merged 17 commits into from
Feb 12, 2025

Conversation

JoshFung
Copy link
Contributor

Overview

  • Implemented logic (e.g. check-in, cover shifts, etc.) for volunteer's Schedule page and details panel
  • Added styling to better reflect designs
  • Same ShiftCards are used in the volunteer dashboard. The buttons to check-in and cover are functional but clicking the card does not currently redirect the user to the Schedule page
  • NOTE: Recent changes restricted overflow on volunteer dashboard so it's not scrollable. I didn't implement change in this ticket because it's becoming too broad for a single ticket.

I was manually testing it out to iron out bugs, but, please let me know if there are any issues that have slipped by!


Details About Different Cases

There a variety of cases based on the shift type and status. I'll try to be as verbose as possible to explain the different cases, but please let me know if there is anything missing!

Primary button refers to the button appearing on the shift card, which also appears as the first button in the details panel. Certain cases will result in additional buttons within the details panel.

Shift types are split into:

  1. Volunteer's own shift
  2. Volunteer's own shift coverage requests
  3. Other volunteer's shift coverage requests

Volunteer's Own Shift

These shifts have the SHIFT_TYPE of MY_SHIFTS as defined in constants.js. The different cases are dependent on whether it's a past shift, a current shift, or a future shift.

These shift cards will have a green bar. On the details panel, the status will say "My Shift."

If there is an associated shift coverage request, only the coverage request will be visible.

For past shifts:

  • If the volunteer checked-in on time, the primary button will say "Checked In"
  • Otherwise, the primary button will say "Missed Shift"

For current shifts:

  • Volunteers can check in using the primary button labeled "Check In", which remains visible during the entire duration of their shift
  • Volunteers can also request coverage using the "Request Coverage" button in the details panel, which creates an associated shift coverage request

For future shifts:

  • The primary button will say "Upcoming"
  • The additional "Request Coverage" button appears in the details panel

Volunteer's Own Shift Coverage Requests

They have the SHIFT_TYPE of MY_COVERAGE_REQUESTS. They revolve around COVERAGE_STATUSES of OPEN OR RESOLVED.

These shift cards have a yellow bar. On the details panel, the status will say "Requested Coverage" or "Shift Filled."

For OPEN status:

  • The primary button says "Requested Coverage"
  • Details panel has an additional "Cancel" button which deletes the coverage request, resulting in the actual shift reappearing

For RESOLVED status:

  • The primary button says "Shift Filled"
  • It should become this status when another volunteer has requested to fulfill this shift coverage and it is approved by an admin
  • Volunteers cannot take back the shift after it has already been filled

Other Volunteer's Shift Coverage Requests

They have the SHIFT_TYPE of COVERAGE. They revolve around the COVERAGE_STATUSES of OPEN, PENDING, or RESOLVED

These shift cards have a red bar. The status in the details panel will either say "Needs Coverage" or "Requested to Cover".

For OPEN status:

  • The primary button says "Cover," upon clicking it, the coverage status changes to PENDING

For PENDING status:

  • The primary button says "Pending Approval"
  • Details panel has an additional button "Cancel" which changes it back to OPEN status if pressed
  • It will remain in this PENDING status until an admin approves this shift coverage or the volunteer presses "Cancel"

For RESOLVED status:

  • This is left for eventual development of the admin dashboard
  • The coverage request should become a regular shift for the volunteer

Copy link
Collaborator

@jjessieshang jjessieshang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Josh! Covered all the button cases and works really smoothly. Left two notes.


const currentDate = dayjs();
const pastShift = currentDate.isAfter(shiftEnd);
const currentShift = currentDate.isBetween(shiftStart, shiftEnd, 'minute', '[]');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's allow volunteer's to check in during a wider time frame, maybe 30 minutes before and after the shift

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I've only made the change here, so the request coverage button will still disappear when the shift ends.

@JoshFung JoshFung merged commit 9a24013 into main Feb 12, 2025
theosiemensrhodes added a commit that referenced this pull request Feb 12, 2025
commit 3766612
Author: theosiemensrhodes <[email protected]>
Date:   Wed Feb 12 10:50:06 2025 -0800

    update frontend to match sql

commit 06ac697
Author: Theo Siemens-Rhodes <[email protected]>
Date:   Wed Feb 12 10:34:43 2025 -0800

    Volunteer Profile Imgs in Side Panel & Ensure admin users have login (#58)

    * add f_name, l_name to user, ensure admin login is successful

    * ensure f_name, l_name inserted, ensure inactive volunteers cannot login

commit 9a24013
Merge: 3a37582 9f8fce7
Author: Josh Fung <[email protected]>
Date:   Tue Feb 11 23:29:28 2025 -0800

    Merge pull request #57 from ubclaunchpad/schedule-button-status-logic

    Schedule Page Logic

commit 9f8fce7
Author: Josh Fung <[email protected]>
Date:   Tue Feb 11 23:08:13 2025 -0800

    Added thirty minute window to check-in before and after the shift

commit bfce70e
Merge: 74daca8 3a37582
Author: Josh Fung <[email protected]>
Date:   Sun Feb 9 16:44:11 2025 -0800

    Merge branch 'main' into schedule-button-status-logic

commit 74daca8
Author: Josh Fung <[email protected]>
Date:   Sat Feb 8 22:41:58 2025 -0800

    Fixed shift cards on volunteer dashboard

commit 7e0721c
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 19:00:12 2025 -0800

    Made panel more similar to designs and buttons more reusable

commit 600e13b
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 17:44:51 2025 -0800

    Past and fulfilled coverage requests are no longer shown

commit ef3f8f5
Merge: 01008da 6842393
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 16:57:21 2025 -0800

    Merge branch 'main' into schedule-button-status-logic

commit 01008da
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 16:23:22 2025 -0800

    Added a different status for your fulfilled coverage requests

commit 584d609
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 12:25:38 2025 -0800

    Refactor and cleanup

commit 5d3403a
Author: Josh Fung <[email protected]>
Date:   Tue Feb 4 15:36:08 2025 -0800

    Added logic for cancelling shift coverage request

commit fd5ca84
Author: Josh Fung <[email protected]>
Date:   Tue Feb 4 00:57:05 2025 -0800

    Added canceling on covering someone else's shift

commit fb625b2
Merge: 3b9120c 9afcfc8
Author: Josh Fung <[email protected]>
Date:   Tue Feb 4 00:14:45 2025 -0800

    Merge branch 'main' into schedule-button-status-logic

commit 3b9120c
Author: Josh Fung <[email protected]>
Date:   Fri Jan 31 12:42:24 2025 -0800

    Implemented basic cover shift logic and re-rendering side panel

commit 2a56827
Author: Josh Fung <[email protected]>
Date:   Tue Jan 28 20:24:07 2025 -0800

    Implemented check in from frontend and refactored so details panel is re-rendered

commit e9ff8bd
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 19:21:24 2025 -0800

    Created API endpoint and routes for shift check-in

commit 4a03f0b
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 17:29:46 2025 -0800

    Corrected prioritization of user's coverage requests over user's shifts

commit 822cf24
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 17:25:21 2025 -0800

    Refactored to reuse fetchShifts()

commit fe30e39
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 16:46:27 2025 -0800

    Filter out duplicate shifts and prioritize showing coverage shifts over user's own shifts
theosiemensrhodes added a commit that referenced this pull request Feb 21, 2025
commit 37305b8
Author: theosiemensrhodes <[email protected]>
Date:   Fri Feb 14 13:05:12 2025 -0800

    updateUser error change

commit 2c5f402
Author: theosiemensrhodes <[email protected]>
Date:   Fri Feb 14 12:53:46 2025 -0800

    fix main merge

commit 02cdb72
Author: theosiemensrhodes <[email protected]>
Date:   Wed Feb 12 11:29:10 2025 -0800

    Merge main into branch

commit a1afe16
Author: theosiemensrhodes <[email protected]>
Date:   Wed Feb 12 11:29:06 2025 -0800

    Squashed commit of the following:

    commit 3766612
    Author: theosiemensrhodes <[email protected]>
    Date:   Wed Feb 12 10:50:06 2025 -0800

        update frontend to match sql

    commit 06ac697
    Author: Theo Siemens-Rhodes <[email protected]>
    Date:   Wed Feb 12 10:34:43 2025 -0800

        Volunteer Profile Imgs in Side Panel & Ensure admin users have login (#58)

        * add f_name, l_name to user, ensure admin login is successful

        * ensure f_name, l_name inserted, ensure inactive volunteers cannot login

    commit 9a24013
    Merge: 3a37582 9f8fce7
    Author: Josh Fung <[email protected]>
    Date:   Tue Feb 11 23:29:28 2025 -0800

        Merge pull request #57 from ubclaunchpad/schedule-button-status-logic

        Schedule Page Logic

    commit 9f8fce7
    Author: Josh Fung <[email protected]>
    Date:   Tue Feb 11 23:08:13 2025 -0800

        Added thirty minute window to check-in before and after the shift

    commit bfce70e
    Merge: 74daca8 3a37582
    Author: Josh Fung <[email protected]>
    Date:   Sun Feb 9 16:44:11 2025 -0800

        Merge branch 'main' into schedule-button-status-logic

    commit 74daca8
    Author: Josh Fung <[email protected]>
    Date:   Sat Feb 8 22:41:58 2025 -0800

        Fixed shift cards on volunteer dashboard

    commit 7e0721c
    Author: Josh Fung <[email protected]>
    Date:   Thu Feb 6 19:00:12 2025 -0800

        Made panel more similar to designs and buttons more reusable

    commit 600e13b
    Author: Josh Fung <[email protected]>
    Date:   Thu Feb 6 17:44:51 2025 -0800

        Past and fulfilled coverage requests are no longer shown

    commit ef3f8f5
    Merge: 01008da 6842393
    Author: Josh Fung <[email protected]>
    Date:   Thu Feb 6 16:57:21 2025 -0800

        Merge branch 'main' into schedule-button-status-logic

    commit 01008da
    Author: Josh Fung <[email protected]>
    Date:   Thu Feb 6 16:23:22 2025 -0800

        Added a different status for your fulfilled coverage requests

    commit 584d609
    Author: Josh Fung <[email protected]>
    Date:   Thu Feb 6 12:25:38 2025 -0800

        Refactor and cleanup

    commit 5d3403a
    Author: Josh Fung <[email protected]>
    Date:   Tue Feb 4 15:36:08 2025 -0800

        Added logic for cancelling shift coverage request

    commit fd5ca84
    Author: Josh Fung <[email protected]>
    Date:   Tue Feb 4 00:57:05 2025 -0800

        Added canceling on covering someone else's shift

    commit fb625b2
    Merge: 3b9120c 9afcfc8
    Author: Josh Fung <[email protected]>
    Date:   Tue Feb 4 00:14:45 2025 -0800

        Merge branch 'main' into schedule-button-status-logic

    commit 3b9120c
    Author: Josh Fung <[email protected]>
    Date:   Fri Jan 31 12:42:24 2025 -0800

        Implemented basic cover shift logic and re-rendering side panel

    commit 2a56827
    Author: Josh Fung <[email protected]>
    Date:   Tue Jan 28 20:24:07 2025 -0800

        Implemented check in from frontend and refactored so details panel is re-rendered

    commit e9ff8bd
    Author: Josh Fung <[email protected]>
    Date:   Sun Jan 26 19:21:24 2025 -0800

        Created API endpoint and routes for shift check-in

    commit 4a03f0b
    Author: Josh Fung <[email protected]>
    Date:   Sun Jan 26 17:29:46 2025 -0800

        Corrected prioritization of user's coverage requests over user's shifts

    commit 822cf24
    Author: Josh Fung <[email protected]>
    Date:   Sun Jan 26 17:25:21 2025 -0800

        Refactored to reuse fetchShifts()

    commit fe30e39
    Author: Josh Fung <[email protected]>
    Date:   Sun Jan 26 16:46:27 2025 -0800

        Filter out duplicate shifts and prioritize showing coverage shifts over user's own shifts

commit 8b412cb
Author: theosiemensrhodes <[email protected]>
Date:   Mon Feb 10 21:59:59 2025 -0800

    remove logs, and excess auth token sending

commit 4561526
Author: theosiemensrhodes <[email protected]>
Date:   Mon Feb 10 21:50:14 2025 -0800

    add auth for every route

commit 4b9d0bf
Author: theosiemensrhodes <[email protected]>
Date:   Mon Feb 10 20:39:55 2025 -0800

    change password, 1 call, prevent req mocking
theosiemensrhodes added a commit that referenced this pull request Feb 21, 2025
* change password, 1 call, prevent req mocking

* add auth for every route

* remove logs, and excess auth token sending

* Squashed commit of the following:

commit 3766612
Author: theosiemensrhodes <[email protected]>
Date:   Wed Feb 12 10:50:06 2025 -0800

    update frontend to match sql

commit 06ac697
Author: Theo Siemens-Rhodes <[email protected]>
Date:   Wed Feb 12 10:34:43 2025 -0800

    Volunteer Profile Imgs in Side Panel & Ensure admin users have login (#58)

    * add f_name, l_name to user, ensure admin login is successful

    * ensure f_name, l_name inserted, ensure inactive volunteers cannot login

commit 9a24013
Merge: 3a37582 9f8fce7
Author: Josh Fung <[email protected]>
Date:   Tue Feb 11 23:29:28 2025 -0800

    Merge pull request #57 from ubclaunchpad/schedule-button-status-logic

    Schedule Page Logic

commit 9f8fce7
Author: Josh Fung <[email protected]>
Date:   Tue Feb 11 23:08:13 2025 -0800

    Added thirty minute window to check-in before and after the shift

commit bfce70e
Merge: 74daca8 3a37582
Author: Josh Fung <[email protected]>
Date:   Sun Feb 9 16:44:11 2025 -0800

    Merge branch 'main' into schedule-button-status-logic

commit 74daca8
Author: Josh Fung <[email protected]>
Date:   Sat Feb 8 22:41:58 2025 -0800

    Fixed shift cards on volunteer dashboard

commit 7e0721c
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 19:00:12 2025 -0800

    Made panel more similar to designs and buttons more reusable

commit 600e13b
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 17:44:51 2025 -0800

    Past and fulfilled coverage requests are no longer shown

commit ef3f8f5
Merge: 01008da 6842393
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 16:57:21 2025 -0800

    Merge branch 'main' into schedule-button-status-logic

commit 01008da
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 16:23:22 2025 -0800

    Added a different status for your fulfilled coverage requests

commit 584d609
Author: Josh Fung <[email protected]>
Date:   Thu Feb 6 12:25:38 2025 -0800

    Refactor and cleanup

commit 5d3403a
Author: Josh Fung <[email protected]>
Date:   Tue Feb 4 15:36:08 2025 -0800

    Added logic for cancelling shift coverage request

commit fd5ca84
Author: Josh Fung <[email protected]>
Date:   Tue Feb 4 00:57:05 2025 -0800

    Added canceling on covering someone else's shift

commit fb625b2
Merge: 3b9120c 9afcfc8
Author: Josh Fung <[email protected]>
Date:   Tue Feb 4 00:14:45 2025 -0800

    Merge branch 'main' into schedule-button-status-logic

commit 3b9120c
Author: Josh Fung <[email protected]>
Date:   Fri Jan 31 12:42:24 2025 -0800

    Implemented basic cover shift logic and re-rendering side panel

commit 2a56827
Author: Josh Fung <[email protected]>
Date:   Tue Jan 28 20:24:07 2025 -0800

    Implemented check in from frontend and refactored so details panel is re-rendered

commit e9ff8bd
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 19:21:24 2025 -0800

    Created API endpoint and routes for shift check-in

commit 4a03f0b
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 17:29:46 2025 -0800

    Corrected prioritization of user's coverage requests over user's shifts

commit 822cf24
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 17:25:21 2025 -0800

    Refactored to reuse fetchShifts()

commit fe30e39
Author: Josh Fung <[email protected]>
Date:   Sun Jan 26 16:46:27 2025 -0800

    Filter out duplicate shifts and prioritize showing coverage shifts over user's own shifts

* Merge main into branch

* fix main merge

* updateUser error change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants