File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,6 @@ const App: React.FC = () => {
118
118
} ;
119
119
120
120
const handleViewSolution = ( e : React . MouseEvent < HTMLAnchorElement > ) => {
121
- // set the score to 0 - you aren't allowed any help
122
- setUseScore ( 0 ) ;
123
121
124
122
// Get question ID
125
123
const questionId = Number ( e . currentTarget . id ) ;
@@ -129,10 +127,15 @@ const App: React.FC = () => {
129
127
let solution = problemList . problems [ questionId ] . solution ;
130
128
let solutionsToShow = [ ...showSolution ] ;
131
129
130
+ // if the solution has not been shown before, set the score to 0
131
+ if ( solutionsToShow [ questionId ] === "" ) {
132
+ // set the score to 0 - you aren't allowed any help
133
+ setUseScore ( 0 ) ;
134
+ }
135
+
132
136
// if the solution is an error, show that we can take "Error" or "ValueError"
133
137
console . log ( 'solution' , solution ) ;
134
138
if ( solution === '"ValueError slice step cannot be zero"' ) {
135
- console . log ( 'hit' ) ;
136
139
solution += ' - Error or ValueError are the accepted answers' ;
137
140
}
138
141
solutionsToShow [ questionId ] = solution ;
You can’t perform that action at this time.
0 commit comments