Skip to content

Commit

Permalink
Bugfix - Variant colour missing in data views
Browse files Browse the repository at this point in the history
Bugfix - EDSM valuable bodies being displayed twice
  • Loading branch information
WarmedxMints committed Dec 26, 2024
1 parent 92e8a04 commit 34b22fb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ODExplorer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class App : Application
{
public static readonly Logger Logger = LogManager.GetCurrentClassLogger();

public static readonly Version AppVersion = new(2, 0, 4);
public static readonly Version AppVersion = new(2, 0, 5);
#if INSTALL
public readonly static string BaseDirectory = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "OD Explorer");
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@
Value="{x:Null}" />
</Style>
</UserControl.Resources>
<Grid Margin="10">
<Grid Margin="10"
x:Name="Grid">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="40" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
Expand All @@ -114,6 +115,7 @@
Header="Genus" />
<DataGridTextColumn Binding="{Binding SpeciesEnglish}"
CellStyle="{DynamicResource DarkerCellLeft}"
Width="SizeToCells"
MinWidth="120"
Header="Species" />
<DataGridTextColumn Binding="{Binding Colour}"
Expand All @@ -122,8 +124,6 @@
Header="Colour" />
<DataGridTextColumn Binding="{Binding BodyName}"
CellStyle="{DynamicResource DarkerCellLeft}"
MinWidth="300"
Width="*"
Header="Body" />
<DataGridTextColumn Binding="{Binding ValueString}"
CellStyle="{DynamicResource CmdrSelectionCellRight}"
Expand All @@ -134,6 +134,7 @@
CellStyle="{DynamicResource CmdrSelectionCellRight}"
HeaderStyle="{DynamicResource DataGridHeaderCenter}"
MinWidth="120"
Width="SizeToCells"
Header="Bonus" />
</DataGrid.Columns>
</DataGrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void BuildTotals()
{
var total = new OrganicTotalsViewModel()
{
EnglishName = item.Key,
EnglishName = item.Key.Contains("Unknown") ? item.First().SpeciesEnglish : item.Key,
Count = item.Count(),
Value = item.Sum(x => x.Value),
Bonus = item.Sum(x => x.Bonus)
Expand Down
2 changes: 1 addition & 1 deletion ODExplorer/Stores/ExplorationDataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ private async Task<bool> GetSystemValue(StarSystem system)
{
foreach (var body in value.ValuableBodies)
{
bool bodyKnown = system.SystemBodies.FirstOrDefault(x => x.EdsmBodyID == body.BodyId) != default;
bool bodyKnown = system.SystemBodies.FirstOrDefault(x => x.EdsmBodyID == body.BodyId || string.Equals(x.BodyName, body.BodyName, StringComparison.OrdinalIgnoreCase)) != default;

if (bodyKnown)
{
Expand Down
18 changes: 17 additions & 1 deletion ODExplorer/ViewModels/ModelVMs/OrganicScanItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,28 @@ public OrganicScanStage ScanStageEnum
}
}

public string Colour
{
get
{
var variant = Item.Variants.FirstOrDefault(x => x.Confirmed);
if (variant is null || variant?.Colour == VariantColours.Unknown)
{
return string.Empty;
}
return $"{variant?.Colour}";
}
}
public string EnglishName
{
get
{

var variant = Item.Variants.FirstOrDefault(x => x.Confirmed);

if(variant is null || variant?.Colour == VariantColours.Unknown)
{
return item.SpeciesLocalised;
}
return $"{item.GenusEnglish} {item.SpeciesEnglish} - {variant?.Colour}";
}
}
Expand Down

0 comments on commit 34b22fb

Please sign in to comment.