Fix undefineds in statistics overview

This commit is contained in:
Florine W. Dekker 2020-08-09 02:01:37 +02:00
parent aa2923a245
commit 0078e94c3b
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
2 changed files with 12 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "minesweeper", "name": "minesweeper",
"version": "0.79.0", "version": "0.79.1",
"description": "Just Minesweeper!", "description": "Just Minesweeper!",
"author": "Felix W. Dekker", "author": "Felix W. Dekker",
"browser": "dist/bundle.js", "browser": "dist/bundle.js",

View File

@ -173,26 +173,24 @@ export class LocalStatistics implements Statistics {
* Generates an HTML report of the current statistics. * Generates an HTML report of the current statistics.
*/ */
generateHtmlReport(): string { generateHtmlReport(): string {
const stats = this.read();
return "" + return "" +
`<h3>Time and history</h3> `<h3>Time and history</h3>
<table> <table>
<tr> <tr>
<th>Actions undone</th> <th>Actions undone</th>
<td>${stats["actionsUndone"]}</td> <td>${this.actionsUndone}</td>
</tr> </tr>
<tr> <tr>
<th>Actions redone</th> <th>Actions redone</th>
<td>${stats["actionsRedone"]}</td> <td>${this.actionsRedone}</td>
</tr> </tr>
<tr> <tr>
<th>Losses undone</th> <th>Losses undone</th>
<td>${stats["lossesUndone"]}</td> <td>${this.lossesUndone}</td>
</tr> </tr>
<tr> <tr>
<th>Time spent</th> <th>Time spent</th>
<td>${formatTime(Math.floor(+stats["timeSpent"] / 1000), true, true)}</td> <td>${formatTime(Math.floor(+this.timeSpent / 1000), true, true)}</td>
</tr> </tr>
</table> </table>
@ -200,15 +198,15 @@ export class LocalStatistics implements Statistics {
<table> <table>
<tr> <tr>
<th>Games started</th> <th>Games started</th>
<td>${stats["gamesStarted"]}</td> <td>${this.gamesStarted}</td>
</tr> </tr>
<tr> <tr>
<th>Games lost</th> <th>Games lost</th>
<td>${stats["gamesLost"]}</td> <td>${this.gamesLost}</td>
</tr> </tr>
<tr> <tr>
<th>Games won</th> <th>Games won</th>
<td>${stats["gamesWon"]}</td> <td>${this.gamesWon}</td>
</tr> </tr>
</table> </table>
@ -216,19 +214,19 @@ export class LocalStatistics implements Statistics {
<table> <table>
<tr> <tr>
<th>Squares chorded</th> <th>Squares chorded</th>
<td>${stats["squaresChorded"]}</td> <td>${this.squaresChorded}</td>
</tr> </tr>
<tr> <tr>
<th>Squares chorded leading to loss</th> <th>Squares chorded leading to loss</th>
<td>${stats["squaresChordedLeadingToLoss"]}</td> <td>${this.squaresChordedLeadingToLoss}</td>
</tr> </tr>
<tr> <tr>
<th>Squares flagged</th> <th>Squares flagged</th>
<td>${stats["squaresFlagged"]}</td> <td>${this.squaresFlagged}</td>
</tr> </tr>
<tr> <tr>
<th>Squares uncovered</th> <th>Squares uncovered</th>
<td>${stats["squaresUncovered"]}</td> <td>${this.squaresUncovered}</td>
</tr> </tr>
</table>`; </table>`;
} }