Skip to content

Use KaptenAllocData class, move non-UI logic out of main#25

Open
eflisback wants to merge 1 commit into
bjornregnell:masterfrom
eflisback:master
Open

Use KaptenAllocData class, move non-UI logic out of main#25
eflisback wants to merge 1 commit into
bjornregnell:masterfrom
eflisback:master

Conversation

@eflisback
Copy link
Copy Markdown
Contributor

This PR is a pretty big refactor which makes issue #1 significantly easier. This is what is being changed:

  • Consistent usage of KaptenAllocData class - Prior to this PR, this class was barely in use, and kapten alloc entries were sometimes represented as raw strings, or an array of its substrings. Now, the generated large string data (data-GENERATED.scala) is immediately parsed to KaptenAllocData instances. This makes filtering and other related functionality cleaner, and also sets it as the standard representation for entries within the source code. The TimeEdit.scala module has been updated to also parse the TimeEdit CSV data into KaptenAllocData instances. This is why Add lecture rows in schedule #1 will be easy to implement, as the data is represented by the same data structures.
  • Moved extension-methods to appropriate files - Most extension methods were for filtering the String-based kapten alloc entries. Since they now operate on a Seq[KaptenAllocData] instead, they have been moved to KaptenAllocData.scala instead.
  • Utility folder for utility functions - Pure functions, such as getDayOfWeek and getWeekNumber have been moved to their own modules within the utils subdirectory together with the procedure function downloadIcs. This reduces the clutter in main.scala, which now only contains the @main startup procedure and UI-related functions.

@eflisback
Copy link
Copy Markdown
Contributor Author

Since this PR is kinda big, I'd understand if a full code review isn't viable. Since a lot of things have been touched or moved, I'd appreciate it if @bjornregnell were to check if all functionality is in tact. I've done my best myself, but don't know the app as well as Björn does. The intention with this PR is not to change any behaviour or functionality!

@eflisback
Copy link
Copy Markdown
Contributor Author

Small side note - Since the UI table is a little less coupled with the raw string data, I could change the table column header for supervisors from handledare to vem.

@bjornregnell
Copy link
Copy Markdown
Owner

bjornregnell commented Oct 5, 2025

@JuliusNicklas Would you like to assign yourself as reviewer?

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.

2 participants