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

CoreUtils::getAcademicYear() misidentifying 2022-23 #1105

Open
markspolakovs opened this issue Jan 5, 2023 · 0 comments
Open

CoreUtils::getAcademicYear() misidentifying 2022-23 #1105

markspolakovs opened this issue Jan 5, 2023 · 0 comments

Comments

@markspolakovs
Copy link
Member

Given this data in the terms table:

start								descr	finish								termid
2022-09-26 00:00:00.000000 +00:00	Autumn	2022-12-05 00:00:00.000000 +00:00	66
2023-01-09 00:00:00.000000 +00:00	Spring	2023-03-20 00:00:00.000000 +00:00	67
2023-04-17 00:00:00.000000 +00:00	Summer	2023-06-26 00:00:00.000000 +00:00	68

CoreUtils::getAcademicYear() returns 2023, not 2022.


The query it runs is

SELECT start FROM public.terms WHERE descr='Autumn'
AND EXTRACT(year FROM start) = $1

where $1 is the current calendar year (date('Y')) in PHP. This returns no rows, because there's no record for the 2023 Autumn Term (because of semesterisation). As such MyRadio defaults to the current year (if there were an autumn term row it'd pick 2022 unless the first day of term was within 49 days).

The simple fix would be to insert a row for it, however this will need revising in September, so I'm wondering if we can do better here.

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

No branches or pull requests

1 participant