Skip to content

Commit

Permalink
acutally fixed placement this time
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Singleton committed Mar 24, 2017
1 parent 4d8b70a commit fd8b230
Showing 1 changed file with 51 additions and 32 deletions.
83 changes: 51 additions & 32 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ if (secondParseInfo.noOf40 > 0 && secondParseInfo.totalCredits !== 160) {
process.exit(1)
}

const placementModulesRemoval = secondParseInfo.noOf40>0 ? 2 : 1
const hasPlacement = secondParseInfo.noOf40>0 ? true : false

console.log("Second year looks good 😄")

Expand Down Expand Up @@ -222,24 +222,30 @@ console.log(`Second year w/o placement: ${best120SecondYearWOPlacement.avgGrade}

console.log("Calculating second year '120' credits w/ placement")

const best120SecondYearWPlacement = { modules: removeLowestCreditModules(flattenedSecondYear, placementModulesRemoval) }
const best120SecondYearWPlacement = { modules: removeLowestCreditModules(flattenedSecondYear, 2) }
best120SecondYearWPlacement.avgGrade = averageGrade(best120SecondYearWPlacement.modules)

console.log(`Second year w/ placement: ${best120SecondYearWPlacement.avgGrade}%`)
if (!hasPlacement) {console.log("Didn't do placement")} else {
console.log(`Second year w/ placement: ${best120SecondYearWPlacement.avgGrade}%`)
}

console.log("Calculating second year '110' credits w/o placement")

const best110SecondYearWOPlacement = { modules: removeLowestCreditModules(noPlacementSecondYearWith10, 0, 10) }
const best110SecondYearWOPlacement = { modules: removeLowestCreditModules(noPlacementSecondYearWith10, 1, 10) }
best110SecondYearWOPlacement.avgGrade = averageGrade(best110SecondYearWOPlacement.modules)

console.log(`Second year w/o placement: ${best110SecondYearWOPlacement.avgGrade}%`)

console.log("Calculating second year '110' credits w/ placement")

const best110SecondYearWPlacement = { modules: removeLowestCreditModules(removeLowestCreditModules(secondYear, placementModulesRemoval), 1, 10) }
const best110SecondYearWPlacement = { modules: removeLowestCreditModules(removeLowestCreditModules(secondYear, 2), 1, 10) }
best110SecondYearWPlacement.avgGrade = averageGrade(best110SecondYearWPlacement.modules)

console.log(`Second year w/ placement: ${best110SecondYearWPlacement.avgGrade}%`)
if (!hasPlacement) {console.log("Didn't do placement")} else {
console.log(`Second year w/ placement: ${best110SecondYearWPlacement.avgGrade}%`)
}

// console.log(`Second year w/ placement: ${best110SecondYearWPlacement.avgGrade}%`)

console.log("Calculating second year '100' credits w/o placement")

Expand All @@ -250,46 +256,59 @@ console.log(`Second year w/o placement: ${best100SecondYearWOPlacement.avgGrade}

console.log("Calculating second year '100' credits w/ placement")

const best100SecondYearWPlacement = { modules: removeLowestCreditModules(flattenedSecondYear, placementModulesRemoval+1) }
const best100SecondYearWPlacement = { modules: removeLowestCreditModules(flattenedSecondYear, 3) }
best100SecondYearWPlacement.avgGrade = averageGrade(best100SecondYearWPlacement.modules)

console.log(`Second year w/ placement: ${best100SecondYearWPlacement.avgGrade}%`)
if (!hasPlacement) {console.log("Didn't do placement")} else {
console.log(`Second year w/ placement: ${best100SecondYearWPlacement.avgGrade}%`)
}

const best120SecondYear = [best120SecondYearWOPlacement, best120SecondYearWPlacement].reduce((before, item) => {
if (before === null) {
return item
} else {
if (item.avgGrade > before.avgGrade) {
// console.log(`Second year w/ placement: ${best100SecondYearWPlacement.avgGrade}%`)
let best120SecondYear;
let best110SecondYear;
let best100SecondYear;
if (hasPlacement) {
best120SecondYear = [best120SecondYearWOPlacement, best120SecondYearWPlacement].reduce((before, item) => {
if (before === null) {
return item
} else {
return before
if (item.avgGrade > before.avgGrade) {
return item
} else {
return before
}
}
}
}, null)
}, null)

const best110SecondYear = [best110SecondYearWOPlacement, best110SecondYearWPlacement].reduce((before, item) => {
if (before === null) {
return item
} else {
if (item.avgGrade > before.avgGrade) {
best110SecondYear = [best110SecondYearWOPlacement, best110SecondYearWPlacement].reduce((before, item) => {
if (before === null) {
return item
} else {
return before
if (item.avgGrade > before.avgGrade) {
return item
} else {
return before
}
}
}
}, null)
}, null)

const best100SecondYear = [best100SecondYearWOPlacement, best100SecondYearWPlacement].reduce((before, item) => {
if (before === null) {
return item
} else {
if (item.avgGrade > before.avgGrade) {
best100SecondYear = [best100SecondYearWOPlacement, best100SecondYearWPlacement].reduce((before, item) => {
if (before === null) {
return item
} else {
return before
if (item.avgGrade > before.avgGrade) {
return item
} else {
return before
}
}
}
}, null)
}, null)
} else {
best120SecondYear = best120SecondYearWOPlacement
best110SecondYear = best110SecondYearWOPlacement
best100SecondYear = best100SecondYearWOPlacement
}


console.log('\n')

Expand Down

0 comments on commit fd8b230

Please sign in to comment.