Skip to content

Fix flaky getAgeData calculations#46

Merged
amyyeung17 merged 2 commits into
mainfrom
fix/get-age-data
Jun 26, 2026
Merged

Fix flaky getAgeData calculations#46
amyyeung17 merged 2 commits into
mainfrom
fix/get-age-data

Conversation

@amyyeung17

@amyyeung17 amyyeung17 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This PR fixes the flaky getAgeData method. Because the calculation involved division using doubles (dividing by ms per year) and time of creation, it would occasionally produce values like 75.9999 instead of 76.00001, and the floored result would return one less ageMonth than expected. In addition, the if statements are reordered to prioritize the most specific fields.

In addition, this removes the dependence on days (parts of code that called setMonth, new Date(bm, by, currDate.getDate()). If a student's birthday falls on a month with less than 31 days and the run month has 31 days (e.g, September and October), it overflows and the student's birthMonth is one more than expected.

@amyyeung17 amyyeung17 requested a review from a team as a code owner June 25, 2026 19:44
ksmontville
ksmontville previously approved these changes Jun 25, 2026
@Emily-ejag Emily-ejag self-requested a review June 25, 2026 22:31
Emily-ejag
Emily-ejag previously approved these changes Jun 25, 2026
@Emily-ejag Emily-ejag added the bug Something isn't working label Jun 26, 2026
@amyyeung17 amyyeung17 dismissed stale reviews from Emily-ejag and ksmontville via 3ca5d28 June 26, 2026 16:17
@amyyeung17 amyyeung17 merged commit f38a2b1 into main Jun 26, 2026
5 checks passed
@amyyeung17 amyyeung17 deleted the fix/get-age-data branch June 26, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants