Repository navigation
Fixed Issue #194 - #209
Open
PaperBagTrick wants to merge 1 commit into
Open
Fixed Issue #194#209PaperBagTrick wants to merge 1 commit into
PaperBagTrick wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, cometCalendarParser and mazevoParser would take data scraped from Comet Calendar and Mazevo respectively, and put it into a triple nested map. Then, this map's data would be sent to an array of MultiBuildingEvents called result.
This caused a sorting issue, since data in a hashmap is not sorted.
This pull request adds code to sort the array of
MultiBuildingEventscalled result before it's data is written to a json file of parsed data. It does this in bothcometCalendarParserandmazevoParserMultiBuildingEvents, from the nebula-api schema library, is astructcontaining an array ofSingleBuildingEvents, which contains an array ofRoomEvents, which contains an array of any object (in this case,Event). Each also holds a string variable (date -> building -> room -> id).The code now includes a nested for loop using indexes and the
slices.sortFunc(...)method from the go slices library to sort each of these arrays by their string variable (date -> building -> room -> id).The sorting functions are unique to each array. For date, it's sorted by ascending date. building and room are alphabetical, and id is by the hex encoding (uses the
.Hex()method).Extra comments were also added explaining the purpose of the new nested for loop, the random order of iterating through maps, and the schema of the result variable.
Testing
for cometCalendarParser...
for mazevoParser...
AI Disclosure
It should be noted that during the preparation of this project, Generative AI tools (including Claude and Gemini) were used to debug parsing issues, help using git commands, structure the PR documentation, and give general examples of sorting Go map keys with slices.SortFunc(...).
I have checked, run, and modified every line of the code generated by AI to achieve a thorough understanding of it, as well as ensure its correctness and compliance with the principles of academic integrity.
I wrote and applied the changes to cometCalendarParser.go and mazevoParser.go myself and tested them locally.
Checklist