Exemplo n.º 1
0
        public static ShowFeedbackCommand GetRandomFeedback(Session session)
        {
            int phase = session.ActivePhase;
            ShowFeedbackCommand sdc = new ShowFeedbackCommand();

            sdc.Phase           = phase;
            sdc.WindowFeedbacks = new List <SetFeedbackCommand>();
            Random r = new Random();

            for (int i = 1; i < 5; i++)
            {
                SetFeedbackCommand sfc = new SetFeedbackCommand();
                sfc.WindowId   = i;
                sfc.JobTitle   = GetJobByClientIdent(GetClientTypeByWindowId(phase, i));
                sfc.TotalScore = r.NextDouble() * 100;
                if (sfc.TotalScore <= 100)
                {
                    sfc.FeedbackGrade = FeedbackStatus.SEHRGUT;
                }
                if (sfc.TotalScore < 2 / 3 * 100)
                {
                    sfc.FeedbackGrade = FeedbackStatus.GUT;
                }
                if (sfc.TotalScore < 1 / 3 * 100)
                {
                    sfc.FeedbackGrade = FeedbackStatus.SCHLECHT;
                }
                sfc.GradeSet         = r.Next(1, 2);
                sfc.CorrectAttempts  = r.Next(0, 50);
                sfc.BadAttempts      = r.Next(0, 50);
                sfc.AveragePrecision = sfc.CorrectAttempts / (double)(sfc.CorrectAttempts + sfc.BadAttempts) * 100;
                sdc.WindowFeedbacks.Add(sfc);
            }
            return(sdc);
        }
Exemplo n.º 2
0
        public static ShowFeedbackCommand GetGameFeedback(Session session)
        {
            int phase = session.ActivePhase;
            Dictionary <int, GameResponse> gameFeedbacks = GetGameFeedbackByPhase(session);
            ShowFeedbackCommand            sdc           = new ShowFeedbackCommand();

            sdc.Phase           = phase;
            sdc.WindowFeedbacks = new List <SetFeedbackCommand>();
            foreach (KeyValuePair <int, GameResponse> kvp in gameFeedbacks)
            {
                SetFeedbackCommand sfc = new SetFeedbackCommand();
                sfc.WindowId   = kvp.Key;
                sfc.JobTitle   = GetJobByClientIdent(GetClientTypeByWindowId(phase, kvp.Key));
                sfc.TotalScore = kvp.Value.CommulativeScore;
                if (sfc.TotalScore <= 100)
                {
                    sfc.FeedbackGrade = FeedbackStatus.SEHRGUT;
                }
                if (sfc.TotalScore < 2 / 3 * 100)
                {
                    sfc.FeedbackGrade = FeedbackStatus.GUT;
                }
                if (sfc.TotalScore < 1 / 3 * 100)
                {
                    sfc.FeedbackGrade = FeedbackStatus.SCHLECHT;
                }
                sfc.GradeSet         = 1;
                sfc.CorrectAttempts  = kvp.Value.CorrectAttempts;
                sfc.BadAttempts      = kvp.Value.FailedAttempts;
                sfc.AveragePrecision = kvp.Value.AveragePrecision;
                sdc.WindowFeedbacks.Add(sfc);
            }
            return(sdc);
        }