Closed chikamichi closed 6 years ago
Switching from:
// model.ts private compute_wpm(attributes?: AppState): number { const a = attributes || this.model.attributes if (!a.stop) return 0 const nb_words = a.keystrokes_nb / 5 // notice the hard-coded value const elapsed = (a.stop.getTime() - a.start.getTime()) / 1000 / 60 // minutes return Math.round(nb_words / elapsed) }
to:
get word_length(): number { return 5 } private compute_wpm(attributes?: AppState): number { const a = attributes || this.model.attributes if (!a.stop) return 0 const nb_words = a.keystrokes_nb / this.word_length const elapsed = (a.stop.getTime() - a.start.getTime()) / 1000 / 60 // minutes return Math.round(nb_words / elapsed) }
returns 0. Same weirdness with a public and/or traditional function, or with a float instead of an integer.
Note: might not be a good idea having a text-dependent word length anyway.
Switching from:
to:
returns 0. Same weirdness with a public and/or traditional function, or with a float instead of an integer.