public SubjectsViewModel() { testPreview = new Models.TestPreview(); testPreview.LoadAll(); //tests = App.CreateSomeTestsTemp(); //subjects = App.Subjects; }
public StatisticsPage(Models.UserStatistics userStatistics) { InitializeComponent(); PlotView.HeightRequest = (double)1 / 3 * Application.Current.MainPage.Height; SolvedTestsLabel.Text = string.Format("{0}", userStatistics.SolvedTests.Count); TotalPointsLabel.Text = userStatistics.Points.Sum().ToString(); var tests = new Models.TestPreview(); tests.LoadAll(); PlotPoints = userStatistics.Points.Zip( userStatistics.SolvedTests, (p, id) => (p, id).ToTuple() ).Select( (tp) => { var count = tests.TestsToPreview.First((test) => test.Id == tp.Item2).Sum((q) => q.Points.Value); return((double)tp.Item1 / count); } ); }