-
Notifications
You must be signed in to change notification settings - Fork 16
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
added ignore module pattern to calculate the first semester, solves #95 #97
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -129,6 +129,22 @@ const ModuleParser = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* list of modules that should be ignored to calculate the first semester | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* check if moduleName matches ignore pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
shouldModuleBeIgnored: (hsluModuleName) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const ignoreModulePatterns = ['INFO_ABEND']; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
let dontIgnore = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ignoreModulePatterns.forEach(ignorePattern => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if(hsluModuleName.includes(ignorePattern)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log(`ignoring module ${hsluModuleName} for first semester calculation`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dontIgnore = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return dontIgnore; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+132
to
+147
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bool variables should always have a positive name, e.g. Besides that, the method name doesn't correspond to what is actually returned. With a name like I'd suggest to change the method like so to make it more easy to understand:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* Generates an array of module objects using the API and the module type mapping json file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -157,6 +173,8 @@ const ModuleParser = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
firstModule = anlasslistApiResponse.items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.slice() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.reverse() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//check if module is is in the ignore list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to add a comment if the method name and docs already explain what's going on :) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.filter(modul => ModuleParser.shouldModuleBeIgnored(modul.anlassnumber)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.find(modul => ModuleParser.isAutumnSemester(modul.anlassnumber) != undefined); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const passedMessage = await i18n.getMessage("Bestanden"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -202,7 +220,7 @@ const ModuleParser = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// sets the UseInStats to true by default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parsedModule.UseInStats = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (ignoreInStatsModules != undefined && ignoreInStatsModules[parsedModule.name]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parsedModule.UseInStats = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parsedModule.UseInStats = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
myCampusModulesList[parsedModule.name] = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
acronym: parsedModule.name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this solution even better 👍