| 68 | } |
| 69 | |
| 70 | export class ChapterRecord implements IChapterRecord { |
| 71 | dict: string |
| 72 | chapter: number | null |
| 73 | timeStamp: number |
| 74 | time: number |
| 75 | correctCount: number |
| 76 | wrongCount: number |
| 77 | wordCount: number |
| 78 | correctWordIndexes: number[] |
| 79 | wordNumber: number |
| 80 | wordRecordIds: number[] |
| 81 | |
| 82 | constructor( |
| 83 | dict: string, |
| 84 | chapter: number | null, |
| 85 | time: number, |
| 86 | correctCount: number, |
| 87 | wrongCount: number, |
| 88 | wordCount: number, |
| 89 | correctWordIndexes: number[], |
| 90 | wordNumber: number, |
| 91 | wordRecordIds: number[], |
| 92 | ) { |
| 93 | this.dict = dict |
| 94 | this.chapter = chapter |
| 95 | this.timeStamp = getUTCUnixTimestamp() |
| 96 | this.time = time |
| 97 | this.correctCount = correctCount |
| 98 | this.wrongCount = wrongCount |
| 99 | this.wordCount = wordCount |
| 100 | this.correctWordIndexes = correctWordIndexes |
| 101 | this.wordNumber = wordNumber |
| 102 | this.wordRecordIds = wordRecordIds |
| 103 | } |
| 104 | |
| 105 | get wpm() { |
| 106 | return Math.round((this.wordCount / this.time) * 60) |
| 107 | } |
| 108 | |
| 109 | get inputAccuracy() { |
| 110 | return Math.round((this.correctCount / this.correctCount + this.wrongCount) * 100) |
| 111 | } |
| 112 | |
| 113 | get wordAccuracy() { |
| 114 | return Math.round((this.correctWordIndexes.length / this.wordNumber) * 100) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | export interface IReviewRecord { |
| 119 | id?: number |
nothing calls this directly
no outgoing calls
no test coverage detected