Exemplo n.º 1
0
        public SubjectsViewModel()
        {
            testPreview = new Models.TestPreview();
            testPreview.LoadAll();


            //tests = App.CreateSomeTestsTemp();
            //subjects = App.Subjects;
        }
Exemplo n.º 2
0
        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);
            }
                );
        }