Skip to content

bug: Ad-hoc mentor availability collected as number of mentees but submitted as hours #298

Description

@yingliu-data

Bug Report

Ad-hoc mentor availability is collected in the UI as "number of mentees" but submitted to the backend as "hours", so the stored/displayed semantics are wrong.

  • src/components/mentorship/Step1BasicInfo.tsx:255-260 — the radio grid is labelled "maximum number of mentees you are available to support" (values 1-5).
  • src/pages/api/mentor-registration.ts:36-66 (esp. line 63) maps that value into hours: parseInt(availability).
  • Backend MentorMonthAvailability(Month month, Integer hours) stores it as hours.

Additionally, long-term hours is silently fabricated as numMentee * 2 (lines 8-9, 29-34) rather than collected.

Reproduction

A mentor selects "5 mentees in May" → stored and later displayed as "5 hours in May". Capacity planning and AD_HOC cycle filtering then operate on incorrect semantics.

Severity

Medium

Potential Risk

  • Corrupted availability/capacity data feeding matching and cycle filtering.

Suggested Fix

  • Align the field: either collect actual hours in the UI, or add/route a distinct "number of mentees" field to the correct backend field, and stop conflating the two.
  • Stop fabricating long-term hours from numMentee; collect it explicitly or send the value the backend actually expects.
  • Add a test asserting the submitted payload matches the UI's meaning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions