Skip to content
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

Get the credits from the new ects field #87

Merged
merged 2 commits into from
Oct 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
eddex marked this conversation as resolved.
Show resolved Hide resolved
parsedModule.credits = item.ects;

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