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

Fix rqFullCreditThresholdLevel ? #38

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
23 changes: 23 additions & 0 deletions lib/models/competition-events/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,29 @@ void test('[email protected]', async t => {
)
})

await t.test('calculates reqEl deduction config', async t => {
const judgeScore = { meta, tally: { 'diffL0.5': 0, diffL1: 1, diffL2: 3, diffL3: 1, diffL4: 0, diffL5: 0, diffL6: 0, diffL7: 0, diffL8: 0 } }
const l1 = judgeScore.tally.diffL1
const l2 = judgeScore.tally.diffL2
const l3 = judgeScore.tally.diffL3

await t.test('default config, partial credit', () => {
assert.equal(judge({}).calculateJudgeResult(judgeScore).result.aqM, 6 - (l1 + l2) * 0.5 - l3)
})

await t.test('maxRqMultiples: 10', () => {
assert.equal(judge({ maxRqMultiples: 10 }).calculateJudgeResult(judgeScore).result.aqM, 10 - ((l1 + l2) * 0.5) - l3)
})

await t.test('rqFullCreditThresholdLevel = 2', () => {
assert.equal(judge({ rqFullCreditThresholdLevel: 2 }).calculateJudgeResult(judgeScore).result.aqM, 6 - (l1 * 0.5) - l2 - l3)
})

await t.test('rqFullCreditThresholdLevel = 0', () => {
assert.equal(judge({ rqFullCreditThresholdLevel: 0 }).calculateJudgeResult(judgeScore).result.aqM, 6 - (l1 + l2) - l3)
})
})

await t.test('Correct default values for empty scoresheet', () => {
assert.deepStrictEqual(
judge({}).calculateJudgeResult({ meta, tally: {} }),
Expand Down
Loading