Skip to content

Commit

Permalink
Merge pull request #87 from eddex/fix/parse_credits_from_new_location
Browse files Browse the repository at this point in the history
Get the credits from the new ects field
  • Loading branch information
eddex authored Oct 16, 2021
2 parents 0b4bf80 + 7c3379d commit 85878d9
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/components/module_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@ const updateModuleTypeList = async (oldModuleTypeList, jsonFilePath) => {

const ModuleParser = {

/**
* Gets the value ("y") of a specified key ("x") in a 'detail' element of the API response.
* detail: [
* key: "x",
* val: "y"
* ]
*/
getItemDetailsValueByKey: (details, key) => {

for (detail of details) {
if (key == detail.key) {
return detail.val;
}
}
return '';
},

/**
* Check if a module was done in Autumn.
* Modules are marked with 'H' for 'Herbstsemester' (autumn)
Expand Down Expand Up @@ -206,10 +189,7 @@ const ModuleParser = {
parsedModule.name = item.anlassnumber;
parsedModule.from = item.from;
parsedModule.to = item.to;

const details = item.details;
const creditsKey = 'ECTS-Punkte';
parsedModule.credits = ModuleParser.getItemDetailsValueByKey(details, creditsKey);
parsedModule.credits = item.ects;

const moduleId = ModuleParser.getModuleIdFromModuleName(parsedModule.name);
parsedModule.moduleType = moduleTypeList[moduleId];
Expand Down

0 comments on commit 85878d9

Please sign in to comment.