Skip to content

Commit

Permalink
fixed a few bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
poma committed Mar 15, 2016
1 parent 821a18a commit bf2d3ce
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion StatsDisplay/FullStatsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class FullStatsWindow : HeroesWindow
public FullStatsWindow()
{
InitializeComponent();
playersTable.ItemsSource = game.Players.OrderBy(p => (game.Me?.Team == 0 ? 1 : -1) * p.Team); // My team is always on top
playersTable.ItemsSource = game.Players.OrderBy(p => ((game.Me?.Team ?? 0) == 0 ? 1 : -1) * p.Team); // My team is always on top
}
}
}
6 changes: 3 additions & 3 deletions StatsDisplay/Helpers/MmrValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
namespace StatsDisplay
{
// There is no way to use bindings as array indexers in WPF so we have to create a converter
public class MmrValueConverter : GenericValueConverter<Dictionary<GameMode, PlayerProfile.MmrValue>, int>
public class MmrValueConverter : GenericValueConverter<Dictionary<GameMode, PlayerProfile.MmrValue>, int?>
{
protected override int Convert(Dictionary<GameMode, PlayerProfile.MmrValue> value)
protected override int? Convert(Dictionary<GameMode, PlayerProfile.MmrValue> value)
{
return value[Properties.Settings.Default.MmrDisplayMode].Mmr;
return value[Properties.Settings.Default.MmrDisplayMode]?.Mmr;
}
}
}
2 changes: 1 addition & 1 deletion StatsFetcher/FileProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static void ExtractFullData(Game game)
{
foreach (var p in game.Players) {
if (p.HotsLogsProfile == null)
return;
continue;
// who wants to look at some dirty html parsing?
try {
p.MapWinRate = float.Parse(p.HotsLogsProfile.GetElementbyId("mapStatistics").SelectSingleNode($".//tr/td[text()='{game.Map}']").SelectSingleNode("./../td[last()]").InnerText.Replace("%", ""));
Expand Down
2 changes: 1 addition & 1 deletion StatsFetcher/PlayerProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public PlayerProfile(Game game, string battleTag, Region region)

// using this properties greatly simplifies style bingings in gui
public bool IsMe { get { return Game.Me == this; } }
public bool IsMyTeam { get { return Game.Me?.Team == Team; } }
public bool IsMyTeam { get { return (Game.Me?.Team ?? 0) == Team; } }

public event PropertyChangedEventHandler PropertyChanged;
public void TriggerPropertyChanged()
Expand Down

0 comments on commit bf2d3ce

Please sign in to comment.