Exemple #1
0
        private const int IncorrectExerciseLimit = 5; // could be a report parameter

        public override IList <ExerciseStatsBySubject> BuildEntities(IEnumerable <ExerciseRecord> records)
        {
            var groupedRecords = records.GroupBy((t) => new { t.Domain, t.Subject });

            var aggregatedStatsList = new List <ExerciseStatsBySubject>();

            foreach (var groupedRecord in groupedRecords)
            {
                var learningSubject = new LearningSubject
                {
                    Name           = groupedRecord.Key.Subject,
                    LearningDomain = new LearningDomain {
                        Name = groupedRecord.Key.Domain
                    }
                };

                var learningObjectiveStats = new ExerciseStatsBySubject
                {
                    Aggregate                 = learningSubject,
                    AverageExerciseCount      = groupedRecord.GroupBy(r => r.UserId).Average(r => r.Count()),
                    AverageExerciseInCorrect  = groupedRecord.GroupBy(r => r.UserId).Average(r => r.Count(e => e.IsInCorrect)),
                    TopInCorrectExercises     = GetTopIncorrectExercises(groupedRecord),
                    NegativeProgressUserStats = GetUserStatsWithoutProgress(groupedRecord),
                    LearningObjectiveStats    = GetLearningObjectiveStats(groupedRecord)
                };
                aggregatedStatsList.Add(learningObjectiveStats);
            }
            return(aggregatedStatsList);
        }
Exemple #2
0
        public async Task AddLS()
        {
            LearningSubject result = await NavigationService.Navigate <LearningSubject>(typeof(LSAddViewModel));

            if (result != null)
            {
                Collection.Add(result);
            }
        }
Exemple #3
0
        private ITrainer getTrainer(LearningSubject subject, ILearnable learnable, Type type, bool useCache)
        {
            if (trainers.ContainsKey(new Tuple <LearningSubject, Type>(subject, type)))
            {
                return
                    ((ITrainer)
                     Activator.CreateInstance(trainers[new Tuple <LearningSubject, Type>(subject, type)], learnable, useCache));
            }

            return(null);
        }
Exemple #4
0
        public ITrainer GetTrainer(LearningSubject subject, ILearnable learnable)
        {
            var all = learnable.GetType().GetInterfaces();
            var learnableInterfaces =
                all.Except(all.SelectMany(x => x.GetInterfaces()))
                .Where(x => x.GetInterfaces().Contains(typeof(ILearnable)));
            var res = new List <ITrainer>();

            foreach (Type type in learnableInterfaces)
            {
                res.Add(getTrainer(subject, learnable, type, false));
            }

            return(res.First());
        }
Exemple #5
0
        public ITrainer GetTrainer(LearningSubject subject, LearningObject obj, bool useCahce)
        {
            Type learnerType = null;

            switch (obj)
            {
            case LearningObject.Network:
                learnerType = typeof(ILearnableNetwork);
                break;

            case LearningObject.Neuron:
                learnerType = typeof(ILearnableNeuron);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(obj), obj, null);
            }


            return(getTrainer(subject, null, learnerType, useCahce));
        }
        public IEnumerable <LearningSubject> GetLearningDataByDate(DateTime maxDateTime)
        {
            var groups = _learningDataCollection.Find(l => l.SubmitDateTime >= maxDateTime.Date && l.SubmitDateTime <= maxDateTime)
                         .GroupBy(d => new { d.Subject, d.Domain, d.LearningObjective })
                         .GroupBy(d => new { d.Key.Subject, d.Key.Domain })
                         .GroupBy(d => d.Key.Subject).ToList();

            var subjects = new List <LearningSubject>();

            foreach (var subjectGroup in groups)
            {
                var subject = new LearningSubject {
                    Name = subjectGroup.Key, Domains = new List <LearningDomain>()
                };
                foreach (var domainGroup in subjectGroup)
                {
                    var domain = new LearningDomain {
                        Name = domainGroup.Key.Domain, Objectives = new List <LearningObjectiveData>()
                    };
                    foreach (var objectiveGroup in domainGroup)
                    {
                        domain.Objectives.Add(new LearningObjectiveData
                        {
                            Name              = objectiveGroup.Key.LearningObjective,
                            LearningData      = objectiveGroup.ToList(),
                            AverageProgress   = Math.Round(objectiveGroup.Where(d => d.Progress != 0).Average(d => d.Progress), 2),
                            NumberOfExercises = objectiveGroup.GroupBy(d => d.SubmittedAnswerId).Count(),
                            NumberOfPupils    = objectiveGroup.GroupBy(d => d.UserId).Count()
                        });
                    }
                    subject.Domains.Add(domain);
                }
                subjects.Add(subject);
            }
            return(subjects);
        }
 private void ValidateLearningSubject(LearningSubject learningSubject, string domain, string subject)
 {
     Assert.AreEqual(domain, learningSubject.LearningDomain.Name);
     Assert.AreEqual(subject, learningSubject.Name);
 }
Exemple #8
0
 public ITrainer GetTrainer(LearningSubject subject, LearningObject obj)
 {
     return(GetTrainer(subject, obj, true));
 }