Exemple #1
0
        public ActionResult AnswerWithFeedback(Feedback model)
        {
            //instanciation d'une instance Feedback360
            String      e    = model.content;
            Feedback360 feed = new Feedback360();

            feed.content = e;

            List <String> dictionnary = BadWordDictionnary.GetDictionnary();
            var           res         = _pi.VerifyNegativityOfFeedback(feed, dictionnary);


            if (res)
            {
                model.isBad = true;
                return(View("AddFeedback", model));
            }
            else
            {
                return(RedirectToAction("ConfirmAnswerWithFeedback", "Collaborator", model));
                //cofirm feedback with asnwers in herer
                //return RedirectToAction("Dashboard", "Collaborator", null);
            }
            //take the content of the feedback here  and store it to get it afterwards in the confirmAnswer action
        }
        public void AddFeedbackToAnswer(Feedback360 feedback)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:8080/PiProject-web/");

            var res  = client.PostAsJsonAsync <Feedback360>("api/answer/AddFeedback", feedback).ContinueWith((posttrack) => posttrack.Result.EnsureSuccessStatusCode()).Result;
            var resy = res.Content;
        }
Exemple #3
0
        public ActionResult ConfirmAnswerWithFeedback(Feedback model)
        {
            var m = model;
            var x = model.isBad;

            _an.AddTestAnswerAff(logger.C_ID, TestToAnswer.ID);
            foreach (var e in mapAnswers)
            {
                _an.AddAnswerToAff(logger.C_ID, TestToAnswer.ID, e.Key.ID, e.Value.ID);
            }


            //the 360 ,  auto note are calculated in JEE, the global note is calculated in here
            List <t_collaborator> targets = _sr.GetTargetList(TestToAnswer.ID);

            _an.RecalculateGlobalNote(targets);


            //add feedback
            Feedback360 feedback = new Feedback360();

            feedback.content = model.content;
            feedback.isBad   = model.isBad;
            feedback.idCollaboratorAffectedTo   = logger.C_ID;
            feedback.idEvaluationTestAffectedTo = TestToAnswer.ID;

            _an.AddFeedbackToAnswer(feedback);
            if (feedback.isBad)
            {
                List <t_collaborator> targetList = _sr.GetTargetList(TestToAnswer.ID);
                foreach (t_collaborator collab in targetList)
                {
                    _sr.IncrementBadFeedbackCountForCollaborator(collab.C_ID);
                    //vérification de rank auto et nbre feedbacks for possible warning
                    _pi.VerifyFeedback(collab.C_ID);
                    _pi.VerifyRank360(collab.C_ID);
                }
            }



            return(RedirectToAction("Dashboard", "Collaborator", null));
        }
Exemple #4
0
        public Boolean VerifyNegativityOfFeedback(Feedback360 feedback, List <String> BadWordsDictionnary)
        {
            char[]        separators = new char[] { ' ' };
            List <String> AllWords   = feedback.content.Split(separators).ToList();

            List <String> badWords = new List <string>();

            foreach (var word in BadWordsDictionnary)
            {
                if (AllWords.Where(w => w.Equals(word)).Any())
                {
                    badWords.Add(word);
                }
            }
            if (badWords.Count >= 2)
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }