File tree 4 files changed +33
-6
lines changed
4 files changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ <h1>Quizdown Demo Page</h1>
37
37
shuffleAnswers: true
38
38
shuffleQuestions: true
39
39
nQuestions: 3
40
+ passingGrade: 80
41
+ customPassMsg: You have Passed!
42
+ customFailMsg: You have not passed
40
43
---
41
44
42
45
#### What's the value of $x$?
@@ -193,4 +196,4 @@ <h1>Quizdown Demo Page</h1>
193
196
</ div >
194
197
</ body >
195
198
196
- </ html >
199
+ </ html >
Original file line number Diff line number Diff line change 23
23
minimumIntegerDigits: 2 ,
24
24
});
25
25
}
26
+
27
+ let gradedPoints = quiz .evaluate ();
28
+ let passed = false ;
29
+ if (quiz .config .passingGrade != undefined ) {
30
+ if ( (Number (gradedPoints )/ Number (quiz .questions .length ) * 100 )
31
+ >= Number (quiz .config .passingGrade ) ) {
32
+ passed = true ;
33
+ }
34
+ }
35
+
26
36
</script >
27
37
28
38
<h3 >{$_ (' resultsTitle' )}</h3 >
61
71
</ol >
62
72
</li >
63
73
{/each }
74
+ <h2 >
75
+ {#if passed == true }
76
+ {quiz .config .customPassMsg }
77
+ {/if }
78
+ {#if passed == false && quiz .config .passingGrade != undefined }
79
+ {quiz .config .customFailMsg }
80
+ {/if }
81
+ </h2 >
64
82
</ol >
65
83
</div >
66
84
</Loading >
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ export class Config {
26
26
primaryColor : string ;
27
27
secondaryColor : string ;
28
28
textColor : string ;
29
+ passingGrade : number | undefined ;
30
+ customPassMsg : string ;
31
+ customFailMsg : string ;
29
32
locale : 'de' | 'en' | 'es' | 'fr' | null ;
30
33
enableRetry : boolean ;
31
34
@@ -41,6 +44,9 @@ export class Config {
41
44
this . primaryColor = get ( options [ 'primaryColor' ] , 'steelblue' ) ;
42
45
this . secondaryColor = get ( options [ 'secondaryColor' ] , '#f2f2f2' ) ;
43
46
this . textColor = get ( options [ 'textColor' ] , 'black' ) ;
47
+ this . passingGrade = get ( options [ 'passingGrade' ] , undefined ) ;
48
+ this . customPassMsg = get ( options [ 'customPassMsg' ] , 'You have passed!' ) ;
49
+ this . customFailMsg = get ( options [ 'customFailMsg' ] , 'You have not passed' ) ;
44
50
this . locale = get ( options [ 'locale' ] , null ) ;
45
51
this . enableRetry = get ( options [ 'enableRetry' ] , true ) ;
46
52
}
You can’t perform that action at this time.
0 commit comments