Skip to content

Commit

Permalink
Merge pull request #79 from vigi86/release/2.1.0
Browse files Browse the repository at this point in the history
Release/2.1.0 (not really, but will be)
  • Loading branch information
Lextum authored Nov 18, 2020
2 parents 7dd6cd7 + a94adb7 commit 7e92680
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 6 deletions.
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ We're open to new feature ideas. Please create an issue to describe your idea *b
- All changes to the module files in `src/data/` have to be done in the `tools/parse_module_types.py` python script.
- Always run the script inside of the `tools/` folder. Otherwise the paths are not correct.
- To get started download the html files from
- [here](https://mycampus.hslu.ch/de-ch/info-i/dokumente-fuers-studium/bachelor/einschreibung/modulbeschriebe/modulbeschriebe-studiengang-informatik/) and save it as `tools/modulbeschriebe_i.html`
- and [here](https://mycampus.hslu.ch/de-ch/info-i/dokumente-fuers-studium/bachelor/einschreibung/modulbeschriebe/modulbeschriebe-wirtschaftsinformatik-neues-curriculum/) and save it as `tools/modulbeschriebe_wi.html`.
- [here](https://mycampus.hslu.ch/de-ch/info-i/dokumente-fuers-studium/bachelor/moduleinschreibung/modulbeschriebe/bachelor-artificial-intelligence-machine-learning/) and save it as `tools/modulbeschriebe_ai.html`
- [here](https://mycampus.hslu.ch/de-ch/info-i/dokumente-fuers-studium/bachelor/moduleinschreibung/modulbeschriebe/modulbeschriebe-studiengang-informatik/) and save it as `tools/modulbeschriebe_i.html`
- [here](https://mycampus.hslu.ch/de-ch/info-i/dokumente-fuers-studium/bachelor/moduleinschreibung/modulbeschriebe/modulbeschriebe-wirtschaftsinformatik-neues-curriculum/) and save it as `tools/modulbeschriebe_wi.html`.

- Install the required python libraries with `pip3 install -r requirements.txt`.
- Make your changes in the script and then run the script to update the files in `src/data/`.
Expand Down
32 changes: 32 additions & 0 deletions src/data/modules_ai.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"AEDCIT": "Zusatzmodul",
"AEDCTO": "Zusatzmodul",
"ANLIS": "Kernmodul",
"ASACPH": "Zusatzmodul",
"ASTAT": "Kernmodul",
"CAEPRO": "Zusatzmodul",
"CHMA": "Erweiterungsmodul",
"DBS": "Kernmodul",
"DIBA": "Kernmodul",
"DIMA": "Erweiterungsmodul",
"DMATH": "Kernmodul",
"ENGDBU": "Zusatzmodul",
"ENGFTD": "Zusatzmodul",
"ENGSDC": "Zusatzmodul",
"ENGTCS": "Zusatzmodul",
"EPRE": "Kernmodul",
"ISF": "Erweiterungsmodul",
"ITRE": "Erweiterungsmodul",
"KUFA": "Erweiterungsmodul",
"LIAL": "Kernmodul",
"MLPW01": "Kernmodul",
"MLPW02": "Kernmodul",
"MOD": "Erweiterungsmodul",
"MWI1": "Erweiterungsmodul",
"PHKI": "Kernmodul",
"PMB": "Projektmodul",
"PRIVACY1": "Erweiterungsmodul",
"PROG": "Kernmodul",
"REUF": "Erweiterungsmodul",
"WEBT": "Erweiterungsmodul"
}
2 changes: 2 additions & 0 deletions src/data/modules_i.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"COBAU": "Erweiterungsmodul",
"CONS": "Erweiterungsmodul",
"CPE_PREP": "Zusatzmodul",
"CPLAB": "Erweiterungsmodul",
"CRS": "Erweiterungsmodul",
"CSA": "Erweiterungsmodul",
"CYBER": "Erweiterungsmodul",
Expand Down Expand Up @@ -91,6 +92,7 @@
"I40_BAS": "Zusatzmodul",
"IAVR": "Majormodul",
"IMATH": "Erweiterungsmodul",
"IMLAB": "Erweiterungsmodul",
"INFKOL": "Erweiterungsmodul",
"INFSEC+MAN": "Erweiterungsmodul",
"INTRO": "Erweiterungsmodul",
Expand Down
1 change: 1 addition & 0 deletions src/data/modules_wi.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"HFD": "Erweiterungsmodul",
"IAVR": "Erweiterungsmodul",
"IMATH": "Erweiterungsmodul",
"IMLAB": "Erweiterungsmodul",
"INMA": "Erweiterungsmodul",
"INTLA": "Erweiterungsmodul",
"IOS": "Erweiterungsmodul",
Expand Down
7 changes: 4 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ const _Student = {
/**
* Gets the acronym of the students study.
* @param {String} studyTitle
* @returns {String} I, ICS or WI
* @returns {String} AI, I, ICS or WI
*/
function getStudyAcronym(studyTitle) {
const studyTitles = {
"bachelor of science in information & cyber security": "ICS",
"bachelor of science in information": "I",
"bachelor of science in computer science": "I",
"bachelor of science in wirtschaftsinformatik": "WI",
"bachelor of science in informatik": "I"
"bachelor of science in informatik": "I",
"bachelor of science in artificial intelligence & machine learning": "AI"
}
studyTitle = studyTitle.toLowerCase().replace(/[0-9]/g, '').trim();
return studyTitles[studyTitle];
Expand Down Expand Up @@ -501,7 +502,7 @@ function createLoadingIcon() {
async function start() {
await i18n.init();
createLoadingIcon();

await getStudentInformations();
const modules = await ModuleParser.generateModuleObjects(_Student.studyAcronym);
generateHtml(modules);
Expand Down
3 changes: 2 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "HSLU simple MEP results",
"version": "2.0.15",
"version": "2.1.0",
"description": "Show the results of your exams in a nice way instead of the crappy default layout.",
"icons": {
"48": "icons/icon-48.png",
Expand Down Expand Up @@ -43,6 +43,7 @@
"data/modules_i.json",
"data/modules_ics.json",
"data/modules_wi.json",
"data/modules_ai.json",
"_locales/*"
],
"default_locale": "de",
Expand Down
31 changes: 31 additions & 0 deletions tools/parse_module_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def parseWebsite():
modules_with_type = {}
ics_modules_with_type = {}
wi_modules_with_type = {}
ai_modules_with_type = {}

for section in sections:
for module_type_html_id in module_type_html_ids:
Expand Down Expand Up @@ -123,6 +124,26 @@ def parseWebsite():
# print(module_id)
wi_modules_with_type[module_id] = id_to_type_mapping[module_type_html_id]

# parse ai modules
tree = html.parse('./modulbeschriebe_ai.html')
doc = html.fromstring(etree.tostring(tree))
sections = doc.find_class(
'download-content large-20 columns append-bottom')

for section in sections:
for module_type_html_id in module_type_html_ids:
module_type_title = section.get_element_by_id(
module_type_html_id, None)
if module_type_title is not None:
modules = section.find_class(
'columns col-collapse small-12 print-12 download-text')
for module in modules:
module_name = str(etree.tostring(module))
if '(' in module_name:
module_id = module_name.split('(')[1].split(')')[0]
#print(module_id)
ai_modules_with_type[module_id] = id_to_type_mapping[module_type_html_id]

# block-weeks are of different types. have to be hardcoded.
modules_with_type['IOTHACK'] = erweiterungsmodul
modules_with_type['IAVR'] = majormodul
Expand Down Expand Up @@ -200,10 +221,12 @@ def parseWebsite():
filepath_i_modules = '../src/data/modules_i.json'
filepath_ics_modules = '../src/data/modules_ics.json'
filepath_wi_modules = '../src/data/modules_wi.json'
filepath_ai_modules = '../src/data/modules_ai.json'

writeModuleFiles(filepath_i_modules, modules_with_type)
writeModuleFiles(filepath_ics_modules, ics_modules_with_type)
writeModuleFiles(filepath_wi_modules, wi_modules_with_type)
writeModuleFiles(filepath_ai_modules, ai_modules_with_type)


def prequisitesCheck():
Expand All @@ -222,6 +245,14 @@ def prequisitesCheck():
https://mycampus.hslu.ch/de-ch/info-i/dokumente-fuers-studium/bachelor/moduleinschreibung/modulbeschriebe/modulbeschriebe-wirtschaftsinformatik-neues-curriculum/ \
and save it as \'tools/modulbeschriebe_wi.html\'.')
return False

f = Path('./modulbeschriebe_ai.html')
if not f.is_file():
print('ERROR: file \'./modulbeschriebe_ai.html\' does not exist.')
print('To get started download the html file from \
https://mycampus.hslu.ch/de-ch/info-i/dokumente-fuers-studium/bachelor/moduleinschreibung/modulbeschriebe/bachelor-artificial-intelligence-machine-learning/ \
and save it as \'tools/modulbeschriebe_ai.html\'.')
return False
return True


Expand Down

0 comments on commit 7e92680

Please sign in to comment.