Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/lib/pegasus/coefficients/s5_2027.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

export default {
// même id pour harmo info et maths
Harmonisation: {
"Harmonisation Concevoir": {
APXF: {
_subject: 2,
'Examen 1': 0.8 * 0.4, // ES1
Expand Down
12 changes: 10 additions & 2 deletions src/lib/pegasus/marks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getDocuments, MARKS_DOCUMENT, REPORT_DOCUMENT } from './documents';
// - '[ID]-Module name [X ECTS]'
// - 'ID Module name [X ECTS]'
// - 'ID_Module name [X ECTS]'
const MODULE_REGEX = /(\[?([a-zA-Z0-9]+)\]? ?-? ?_?)?(.*) *\[ *(.*) ECTS]/;
const MODULE_REGEX = /(?:\[(.+)\] |(.+)_|(.+) - |\[(.+)\] - |\[(.+)\]-|([A-Z0-1]+) )?(.*) +\[ *(.*) ECTS\]/;
const MARK_REGEX = /\d+,\d\d/g;
const POSITION_THRESHOLD = 5;

Expand Down Expand Up @@ -91,7 +91,15 @@ async function parsePage(page, result, report)
}

while (i < texts.length && texts[i].match(MODULE_REGEX)) {
const [,, id, name, credits] = texts[i++].match(MODULE_REGEX);
let id, name, credits

const regexGroups = texts[i++].match(MODULE_REGEX).filter(s => !!s);

if (regexGroups.length == 3)
[, name, credits] = regexGroups;
else
[, id, name, credits] = regexGroups;

const subjects = [];
let grade, average, classAverage;

Expand Down