3434 Characters
3535 </p >
3636 <h2 class =" value" >
37- {{ stats. correctInputs }}
37+ {{ correctInputs }}
3838 </h2 >
3939 </div >
4040 </div >
4747 <p >Longest correction time: {{ format(longestTimeOfCorrection) }} s</p >
4848 </template >
4949 <template v-else >
50- <p >You made a mistake after {{ stats. correctInputs }} correct characters</p >
51- <p >{{ stats.codeLength - stats.correctInputs }} characters left</p >
50+ <p >You made a mistake after {{ correctInputs }} correct characters</p >
51+ <p >{{ stats.file.lines - stats.correctLines }} lines left</p >
5252 <p >{{ percentCompleted }}% completed</p >
5353 </template >
5454 </div >
@@ -116,20 +116,23 @@ export default {
116116 mistakes () {
117117 return this .history .filter ((change ) => change .type === ' mistake' );
118118 },
119+ correctInputs () {
120+ return this .history .reduce ((acc , event ) => (event .type === ' correct' ? acc + 1 : acc), 0 );
121+ },
119122 minutes () {
120123 return Math .floor (this .stats .timeFromFirstInput / 1000 / 60 );
121124 },
122125 seconds () {
123126 return Math .round ((this .stats .timeFromFirstInput / 1000 ) % 60 );
124127 },
125128 CPM () {
126- return this .stats . correctInputs / this .format (this .stats .timeFromFirstInput , 4 ) * 60 ;
129+ return this .correctInputs / this .format (this .stats .timeFromFirstInput , 4 ) * 60 ;
127130 },
128131 WPM () {
129132 return this .CPM / 5 ;
130133 },
131134 percentCompleted () {
132- return this .format (this .stats . correctInputs / this .stats .codeLength , 1 , 100 );
135+ return this .format (this .correctLines / this .stats .file . lines , 1 , 100 );
133136 },
134137 mostMistakesInARow () {
135138 return this .mistakes .map ((obj ) => obj .fixQueuePos )
@@ -156,7 +159,7 @@ export default {
156159 return timesAcc;
157160 },
158161 WPMWithoutTimeLost () {
159- return this .stats . correctInputs / this .format (this .stats .timeFromFirstInput - this .totalTimeLost , 4 ) * 60 / 5 ;
162+ return this .correctInputs / this .format (this .stats .timeFromFirstInput - this .totalTimeLost , 4 ) * 60 / 5 ;
160163 },
161164 totalTimeLost () {
162165 return this .correctionTimes .reduce ((acc , value ) => acc + value, 0 );
@@ -176,7 +179,7 @@ export default {
176179 wpm: this .format (this .WPM , 0 , 1 ),
177180 minutes: this .minutes ,
178181 seconds: this .seconds ,
179- correct: this .stats . correctInputs ,
182+ correct: this .correctInputs ,
180183 });
181184
182185 // if (this.stats.file.index !== -1) {
@@ -216,7 +219,7 @@ export default {
216219 percentCompleted: this .percentCompleted ,
217220 },
218221 misc: {
219- correctClicks: this .stats . correctInputs ,
222+ correctClicks: this .correctInputs ,
220223 correctLines: this .stats .correctLines ,
221224 backspaceClicks,
222225 deletingTime: this .format (deletingTime, 0 ),
0 commit comments