Don't set FC-Id if char has FC exclusion set

This commit is contained in:
Liza 2024-03-03 20:14:17 +01:00
parent 1cbe018642
commit c7ceaa2cfd
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework> <TargetFramework>net7.0-windows</TargetFramework>
<Version>0.7</Version> <Version>0.8</Version>
<LangVersion>11.0</LangVersion> <LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -86,11 +86,15 @@ internal sealed class InfluxStatisticsClient : IDisposable
{ {
update.LocalStats.TryGetValue(character, out LocalStats? localStats); update.LocalStats.TryGetValue(character, out LocalStats? localStats);
bool includeFc = character.FreeCompanyId > 0 &&
_configuration.IncludedCharacters.Any(x =>
x.LocalContentId == character.CharacterId && x.IncludeFreeCompany);
values.Add(PointData.Measurement("currency") values.Add(PointData.Measurement("currency")
.Tag("id", character.CharacterId.ToString()) .Tag("id", character.CharacterId.ToString())
.Tag("player_name", character.Name) .Tag("player_name", character.Name)
.Tag("type", character.CharacterType.ToString()) .Tag("type", character.CharacterType.ToString())
.Tag("fc_id", character.FreeCompanyId > 0 ? character.FreeCompanyId.ToString() : null) .Tag("fc_id", includeFc ? character.FreeCompanyId.ToString() : null)
.Field("gil", localStats?.Gil ?? currencies.Gil) .Field("gil", localStats?.Gil ?? currencies.Gil)
.Field("mgp", localStats?.MGP ?? 0) .Field("mgp", localStats?.MGP ?? 0)
.Field("ventures", currencies.Ventures) .Field("ventures", currencies.Ventures)
@ -104,7 +108,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
.Tag("id", character.CharacterId.ToString()) .Tag("id", character.CharacterId.ToString())
.Tag("player_name", character.Name) .Tag("player_name", character.Name)
.Tag("type", character.CharacterType.ToString()) .Tag("type", character.CharacterType.ToString())
.Tag("fc_id", character.FreeCompanyId > 0 ? character.FreeCompanyId.ToString() : null) .Tag("fc_id", includeFc ? character.FreeCompanyId.ToString() : null)
.Field("gc", localStats.GrandCompany) .Field("gc", localStats.GrandCompany)
.Field("gc_rank", localStats.GcRank) .Field("gc_rank", localStats.GcRank)
.Field("seals", (GrandCompany)localStats.GrandCompany switch .Field("seals", (GrandCompany)localStats.GrandCompany switch
@ -143,8 +147,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
.Tag("id", character.CharacterId.ToString()) .Tag("id", character.CharacterId.ToString())
.Tag("player_name", character.Name) .Tag("player_name", character.Name)
.Tag("type", character.CharacterType.ToString()) .Tag("type", character.CharacterType.ToString())
.Tag("fc_id", .Tag("fc_id", includeFc ? character.FreeCompanyId.ToString() : null)
character.FreeCompanyId > 0 ? character.FreeCompanyId.ToString() : null)
.Tag("job", abbreviation) .Tag("job", abbreviation)
.Field("level", level) .Field("level", level)
.Timestamp(date, WritePrecision.S)); .Timestamp(date, WritePrecision.S));
@ -158,8 +161,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
.Tag("id", character.CharacterId.ToString()) .Tag("id", character.CharacterId.ToString())
.Tag("player_name", character.Name) .Tag("player_name", character.Name)
.Tag("msq_name", localStats.MsqName) .Tag("msq_name", localStats.MsqName)
.Tag("fc_id", .Tag("fc_id", includeFc ? character.FreeCompanyId.ToString() : null)
character.FreeCompanyId > 0 ? character.FreeCompanyId.ToString() : null)
.Field("msq_count", localStats.MsqCount) .Field("msq_count", localStats.MsqCount)
.Field("msq_genre", localStats.MsqGenre) .Field("msq_genre", localStats.MsqGenre)
.Timestamp(date, WritePrecision.S)); .Timestamp(date, WritePrecision.S));