Add percentage of valid indexes, groups and keys to the table

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 8eb1f82048
commit 4b4b6fabc0
  1. 4
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt
  2. 6
      archive/src/main/resources/org/openrs2/archive/templates/caches/index.html

@ -19,11 +19,15 @@ public class CacheExporter @Inject constructor(
) {
public data class ArchiveStats(val indexes: Long, val validIndexes: Long) {
public val allIndexesValid: Boolean = indexes == validIndexes
public val validIndexesFraction: Double = validIndexes.toDouble() / indexes
}
public data class GroupStats(val groups: Long, val validGroups: Long, val keys: Long, val validKeys: Long) {
public val allGroupsValid: Boolean = groups == validGroups
public val validGroupsFraction: Double = validGroups.toDouble() / groups
public val allKeysValid: Boolean = keys == validKeys
public val validKeysFraction: Double = validKeys.toDouble() / keys
}
public data class Cache(

@ -38,17 +38,17 @@
<td th:text="${cache.name}"></td>
<td
th:class="${cache.archiveStats}? (${cache.archiveStats.allIndexesValid}? 'table-success' : 'table-danger')"
th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} : 'Calculating...'"
th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} + ' (' + ${#numbers.formatPercent(cache.archiveStats.validIndexesFraction, 1, 2)} + ')' : 'Calculating...'"
>Calculating...
</td>
<td
th:class="${cache.groupStats}? (${cache.groupStats.allGroupsValid}? 'table-success' : 'table-warning')"
th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validGroups, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.groups, 1, 'COMMA')} : 'Calculating...'"
th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validGroups, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.groups, 1, 'COMMA')} + ' (' + ${#numbers.formatPercent(cache.groupStats.validGroupsFraction, 1, 2)} + ')' : 'Calculating...'"
>Calculating...
</td>
<td
th:class="${cache.groupStats}? (${cache.groupStats.allKeysValid}? 'table-success' : 'table-warning')"
th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validKeys, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.keys, 1, 'COMMA')} : 'Calculating...'"
th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validKeys, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.keys, 1, 'COMMA')} + ' (' + ${#numbers.formatPercent(cache.groupStats.validKeysFraction, 1, 2)} + ')' : 'Calculating...'"
>Calculating...
</td>
<td>

Loading…
Cancel
Save