Clean up some influx client logic

master
Liza 2024-03-06 01:17:52 +01:00
parent bd28ba259c
commit 72ba501bd6
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 3 additions and 7 deletions

View File

@ -73,6 +73,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
return;
DateTime date = DateTime.UtcNow;
date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);
IReadOnlyDictionary<Character, Currencies> currencyStats = update.Currencies;
var validFcIds = currencyStats.Keys
@ -162,7 +163,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
.Timestamp(date, WritePrecision.S);
yield return pointData("currency")
.Field("gil", localStats?.Gil ?? currencies.Gil)
.Field("gil", localStats?.Gil ?? 0)
.Field("mgp", localStats?.MGP ?? 0)
.Field("ventures", currencies.Ventures)
.Field("ceruleum_tanks", currencies.CeruleumTanks)
@ -171,10 +172,6 @@ internal sealed class InfluxStatisticsClient : IDisposable
if (localStats != null)
{
yield return pointData("grandcompany")
.Tag("id", character.CharacterId.ToString())
.Tag("player_name", character.Name)
.Tag("type", character.CharacterType.ToString())
.Tag("fc_id", includeFc ? character.FreeCompanyId.ToString() : null)
.Field("gc", localStats.GrandCompany)
.Field("gc_rank", localStats.GcRank)
.Field("seals", (GrandCompany)localStats.GrandCompany switch
@ -279,7 +276,6 @@ internal sealed class InfluxStatisticsClient : IDisposable
.GroupBy(x => new { x.ItemId, x.IsHq }))
{
_prices.TryGetValue(item.Key.ItemId, out PriceInfo priceInfo);
_pluginLog.Information($"CH {localContentId} → {priceInfo.Name} x {item.Sum(x => x.Quantity)}");
bool priceHq = item.Key.IsHq || priceInfo.UiCategory == 58; // materia always uses HQ prices

View File

@ -14,6 +14,6 @@ public sealed record LocalStats
public int MsqCount { get; set; } = -1;
public string? MsqName { get; set; }
public uint MsqGenre { get; set; }
public int? Gil { get; set; }
public int Gil { get; set; }
public int MGP { get; set; }
}