diff --git a/Sources/Stim.Model/Game.cs b/Sources/Stim.Model/Game.cs index 4af1b2d..144f429 100644 --- a/Sources/Stim.Model/Game.cs +++ b/Sources/Stim.Model/Game.cs @@ -92,7 +92,12 @@ namespace Model [DataMember] public List Reviews { get; private init; } - public double Average => Math.Round((double)Reviews.Select(review=>review.Rate).Average(), 1); // FAUT FIX POUR QUAND Y'A PAS DE REVIEWS + public double Average => AverageCalc(); + public double AverageCalc() + { + if (Reviews.Count > 0) return Math.Round((double)Reviews.Select(review => review.Rate).Average(), 1); // FAUT FIX POUR QUAND Y'A PAS DE REVIEWS + else return 0; + } [DataMember] public string? Lien { diff --git a/Sources/Stim/AddGamePage.xaml.cs b/Sources/Stim/AddGamePage.xaml.cs index 328e8e6..de5bd0c 100644 --- a/Sources/Stim/AddGamePage.xaml.cs +++ b/Sources/Stim/AddGamePage.xaml.cs @@ -2,8 +2,6 @@ using Model; using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific; using Application = Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific.Application; using CommunityToolkit.Maui.Views; -//using Windows.Gaming.Preview.GamesEnumeration; - namespace Stim; public partial class AddGamePage : ContentPage