Skip to content

Conversation

@axelbjo
Copy link
Contributor

@axelbjo axelbjo commented Nov 7, 2025

📌 Summary

Fixes https://kth-se.atlassian.net/browse/KUI-2067


🔍 Changes

  • Added mapping for syllabusValid object
  • Added helper function for generating validUntilTerm value
  • Added test for validUntilTerm helper function
  • Updated seasonStr to be able to handle both Ladok and Kopps format for semesters (HT2020 / 20202)
  • This PR NEEDS to be released in conjunction with this change: https://github.com/KTH/studadm-om-kursen-packages/pull/158

✅ Checklist (Author)

  • Code builds locally without errors
  • Tests added/updated and passing
  • Linting/formatting applied
  • No sensitive data in the diff
  • No stray console.logs in the diff
  • No stray comments in the diff
  • Docs/README/CHANGELOG updated (if needed)
  • Sufficient logging
  • Errors are handled accordingly

🧪 Testing & Verification

  1. Tested the following flow:
  • Pick a course that has a kursversion valid from a certain semester (let's say it's VT2026) with kurstillfällen belonging to it
  • In integrationtest, create a new kurstillfälle for a semester taking place at least one semester (HT2025) earlier on a different kursversion
  • Publish this and set its status to 'Komplett'
  • Start the application and pick the kurstillfälle för HT2025
  • Create the course memo, preview and publish it (the page will crash but that's ok)
  • Go to https://www-r.referens.sys.kth.se/kurs-pm/name_of_your_course/om-kurs-pm
  • Click on the course round you worked with
  • On the page that just opened, click the link that says "Skriv ut eller spara kurs-PM"
  • On the front page of this pdf preview, there is a line that says "* Information hämtas från..."
  • In the parantheses on this line there should be a semester, followed by a dash, followed by another semester, like this:
    (VT2019 - HT2025)
  • The first semester is the 'validFromTerm' semester, taken from 'giltigFrom' of the syllabus. The second semester is the 'validUntilTerm' semester, which is generated based on if there is a syllabus with a 'giltigFrom' semester that takes place later than the current syllabus's 'giltigFrom' semester. This value will be the semster taking place right before the later syllabus's validFromTerm. In this case the later syllabus's validFromTerm was 'VT2026', so 'HT2025' will be generated for 'validUntilTerm' .

⚠️ Impact / Risks


🚧 Out of Scope


📦 Downstream apps

Copy link
Contributor

@belanglos belanglos left a comment

Choose a reason for hiding this comment

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

Good stuff!
I think it would be good to get semesterUtils into this project though, so that we have one unified way of dealing with semesters.

Please have a look at my comments and then we can sync!

Copy link
Contributor

@belanglos belanglos left a comment

Choose a reason for hiding this comment

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

Nice!
We should be able to use semesterutils in more places that we touched though.
And we might be able to put it in a shared folder.

* @returns YearSemesterNumberArray, e.g. [2024, 1]
*/
const parseLadokSemester = semester => {
export const parseLadokSemester = semester => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be enough to use parseSemesterIntoYearSemesterNumber, as it has a fallback. But I actually like that we use the more specific function if we know that we have a ladokSemester.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point actually. Starting to think it might be better to use parseSemesterIntoYearSemesterNumber instead in case it for some reason isn't a Ladok semester.


describe('parseLadokSemester', () => {
test('parseLadokSemester', () => {
expect(parseLadokSemester('HT2024')).toEqual([2024, 2])
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add at least one more combination?

@axelbjo
Copy link
Contributor Author

axelbjo commented Nov 17, 2025

@belanglos Added more of your requested changes. What do you think?

@axelbjo
Copy link
Contributor Author

axelbjo commented Nov 19, 2025

Reminder to self: this needs to be released with the changes in changes in om-kursen-ladok-client

Copy link
Contributor

@belanglos belanglos left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

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.

3 participants