Skip to content

fix: exclude 0-hour ad-hoc availability from mentor cycle list (#726, #762) - #763

Open
yingliu-data wants to merge 1 commit into
mainfrom
fix/726-zero-hour-adhoc-availability
Open

fix: exclude 0-hour ad-hoc availability from mentor cycle list (#726, #762)#763
yingliu-data wants to merge 1 commit into
mainfrom
fix/726-zero-hour-adhoc-availability

Conversation

@yingliu-data

Copy link
Copy Markdown

Summary

A mentor who declared a month with 0 hours of ad-hoc availability was still surfaced in that cycle's public mentor list, because a ticked-but-zero-hour month was treated as real availability. This fixes it on both the backend (display) and the admin form (data entry).

Backend — exclude 0-hour availability from the cycle list

MenteeSection.toDtoForCycle now drops ad-hoc entries with zero (or null) hours in addition to the existing current-month filter. A mentor whose only availability for the cycle month is 0 hours no longer derives the AD_HOC type, so they are excluded from the ad-hoc mentor list. This also cleans up any existing 0-hour data.

Admin (edit-mentor form) — keep the checkbox in sync with hours

In admin-wcc-app's MentorshipAvailabilitySection:

  • Typing hours > 0 auto-ticks the month; setting hours = 0 auto-unticks it.
  • Unticking a month resets its hours to 0.
  • transformFormData submits only months with hours > 0, so a 0-hour month is never saved as available in the first place.

Testing

  • Backend: verified locally end-to-end — with the open cycle set to ad-hoc/July, a mentor set to July/0h is excluded from GET /api/cms/v1/mentorship/mentors?mentorshipTypes=AD_HOC, while a mentor with July/3h remains.
  • Admin: verified the checkbox/hours sync and that a 0-hour month is not submitted; tsc, eslint, and prettier pass on the changed files.

Note: a backend regression test for the 0-hour exclusion was prepared but is not included in this PR (excluded intentionally). Happy to add it in a follow-up.

Closes

Related (not fixed here)

Part of the broader mentor availability / admin-form and mentors-display cluster:

Backend: MenteeSection.toDtoForCycle now drops ad-hoc entries with zero
(or null) hours in addition to the existing month filter, so a mentor
who declared a month with 0 hours no longer surfaces in that cycle's
mentor list.

Admin edit-mentor form: keep the month checkbox in sync with its hours
(> 0 ticks it, 0 unticks it; unticking clears the hours) and submit only
months with positive hours, so a 0-hour month is never saved as
available in the first place.

Closes #726
Closes #762
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
platform-admin Ignored Ignored Jul 4, 2026 12:30pm

@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant