[Fix] Fixed refresh formatting inconsistency

${refresh} now uses clock formatting
${refreshFull} now uses full date formatting

Affected issues: #738
This commit is contained in:
Rsl1122 2018-10-14 22:11:47 +03:00
parent 72f0937524
commit a757bf7334
5 changed files with 10 additions and 4 deletions

View File

@ -110,7 +110,8 @@ public class AnalysisContainer extends DataContainer {
putRawData(AnalysisKeys.ANALYSIS_TIME_DAY_AGO, now - TimeUnit.DAYS.toMillis(1L));
putRawData(AnalysisKeys.ANALYSIS_TIME_WEEK_AGO, now - TimeAmount.WEEK.toMillis(1L));
putRawData(AnalysisKeys.ANALYSIS_TIME_MONTH_AGO, now - TimeAmount.MONTH.toMillis(1L));
putSupplier(AnalysisKeys.REFRESH_TIME_F, () -> formatters.secondLong().apply(getUnsafe(AnalysisKeys.ANALYSIS_TIME)));
putSupplier(AnalysisKeys.REFRESH_TIME_F, () -> formatters.clockLong().apply(getUnsafe(AnalysisKeys.ANALYSIS_TIME)));
putSupplier(AnalysisKeys.REFRESH_TIME_FULL_F, () -> formatters.secondLong().apply(getUnsafe(AnalysisKeys.ANALYSIS_TIME)));
putRawData(AnalysisKeys.VERSION, version);
putSupplier(AnalysisKeys.TIME_ZONE, config::getTimeZoneOffsetHours);

View File

@ -60,6 +60,7 @@ public class AnalysisKeys {
public static final PlaceholderKey<String> PLUGINS_TAB_NAV = new PlaceholderKey<>(String.class, "navPluginsTabs");
// Formatted time values
public static final PlaceholderKey<String> REFRESH_TIME_F = CommonPlaceholderKeys.REFRESH_TIME_F;
public static final PlaceholderKey<String> REFRESH_TIME_FULL_F = CommonPlaceholderKeys.REFRESH_TIME_FULL_F;
public static final PlaceholderKey<String> LAST_PEAK_TIME_F = CommonPlaceholderKeys.LAST_PEAK_TIME_F;
public static final PlaceholderKey<String> ALL_TIME_PEAK_TIME_F = CommonPlaceholderKeys.ALL_TIME_PEAK_TIME_F;
public static final PlaceholderKey<String> AVERAGE_SESSION_LENGTH_F = new PlaceholderKey<>(String.class, "sessionAverage");

View File

@ -22,8 +22,8 @@ class CommonPlaceholderKeys {
static final PlaceholderKey<String> ACTIVITY_STACK_SERIES = new PlaceholderKey<>(String.class, "activityStackSeries");
static final PlaceholderKey<String> ACTIVITY_STACK_CATEGORIES = new PlaceholderKey<>(String.class, "activityStackCategories");
static final PlaceholderKey<String> ACTIVITY_PIE_SERIES = new PlaceholderKey<>(String.class, "activityPieSeries");
public static final PlaceholderKey<String> COUNTRY_CATEGORIES = new PlaceholderKey<>(String.class, "countryCategories");
public static final PlaceholderKey<String> COUNTRY_SERIES = new PlaceholderKey<>(String.class, "countrySeries");
static final PlaceholderKey<String> COUNTRY_CATEGORIES = new PlaceholderKey<>(String.class, "countryCategories");
static final PlaceholderKey<String> COUNTRY_SERIES = new PlaceholderKey<>(String.class, "countrySeries");
static final PlaceholderKey<String> HEALTH_NOTES = new PlaceholderKey<>(String.class, "healthNotes");
static final PlaceholderKey<Double> HEALTH_INDEX = new PlaceholderKey<>(Double.class, "healthIndex");
@ -36,6 +36,7 @@ class CommonPlaceholderKeys {
static final PlaceholderKey<Integer> PLAYERS_NEW_MONTH = new PlaceholderKey<>(Integer.class, "playersNewMonth");
static final PlaceholderKey<String> REFRESH_TIME_F = new PlaceholderKey<>(String.class, "refresh");
static final PlaceholderKey<String> REFRESH_TIME_FULL_F = new PlaceholderKey<>(String.class, "refreshFull");
static final PlaceholderKey<String> LAST_PEAK_TIME_F = new PlaceholderKey<>(String.class, "lastPeakTime");
static final PlaceholderKey<String> ALL_TIME_PEAK_TIME_F = new PlaceholderKey<>(String.class, "bestPeakTime");
static final PlaceholderKey<String> PLAYERS_LAST_PEAK = new PlaceholderKey<>(String.class, "playersLastPeak");

View File

@ -110,7 +110,7 @@ public class AnalysisPage implements Page {
private void miscTotals(PlaceholderReplacer placeholderReplacer) {
timings.start(CHANNEL + " Misc. totals");
placeholderReplacer.addAllPlaceholdersFrom(analysisContainer,
REFRESH_TIME_F, LAST_PEAK_TIME_F, ALL_TIME_PEAK_TIME_F,
REFRESH_TIME_F, REFRESH_TIME_FULL_F, LAST_PEAK_TIME_F, ALL_TIME_PEAK_TIME_F,
AVERAGE_SESSION_LENGTH_F, AVERAGE_PLAYTIME_F, PLAYTIME_F,
PLAYERS_LAST_PEAK, PLAYERS_ALL_TIME_PEAK, OPERATORS,

View File

@ -60,6 +60,7 @@ public class InspectPage implements Page {
private final Formatter<Long> timeAmountFormatter;
private final Formatter<Long> clockLongFormatter;
private final Formatter<Long> secondLongFormatter;
private final Formatter<Long> yearLongFormatter;
private final Formatter<Double> decimalFormatter;
@ -90,6 +91,7 @@ public class InspectPage implements Page {
timeAmountFormatter = formatters.timeAmount();
clockLongFormatter = formatters.clockLong();
secondLongFormatter = formatters.secondLong();
yearLongFormatter = formatters.yearLong();
decimalFormatter = formatters.decimals();
}
@ -118,6 +120,7 @@ public class InspectPage implements Page {
PlaceholderReplacer replacer = new PlaceholderReplacer();
replacer.put("refresh", clockLongFormatter.apply(now));
replacer.put("refreshFull", secondLongFormatter.apply(now));
replacer.put("version", version);
replacer.put("timeZone", config.getTimeZoneOffsetHours());