Package org.webcamp.questionary.dto

Examples of org.webcamp.questionary.dto.Score


      if (userCorrectAnswers == userAnswers.size() && userCorrectAnswers == correctAnswers) {
        correctlyAnsweredQuestions++;
      }
    }
    int score = 100 * correctlyAnsweredQuestions / questionary.getQuestions().size();
    Score result = new Score();
    result.setValue(score + "%");
    if (score > 90) {
      result.setStyle(Score.SUCCESS);
    } else if (score < 16) {
      result.setStyle(Score.DANGER);
    } else {
      result.setStyle(Score.WARNING);
    }
    return result;
  }
View Full Code Here


    progress.getAnswers().add(userAnswers);

    if (progress.getCurrentQuestionIndex() == progress.getQuestionary().getQuestions().size() - 1) {

      PercentileScore ps = new PercentileScore();
      Score score = ps.evaluate(progress.getQuestionary(), progress.getAnswers());

      User user = (User) session.getAttribute("user");
      QuestionaryResult result = new QuestionaryResult();
      result.setUserId(user.getId());
      result.setDate(new Date());
      result.setQuestionaryName(progress.getQuestionary().getName());
      result.setResult(score.getValue());
      resultsService.addResult(result);

      return new ModelAndView("results", "score", score);
    } else {
      progress.setCurrentQuestionIndex(progress.getCurrentQuestionIndex() + 1);
View Full Code Here

TOP

Related Classes of org.webcamp.questionary.dto.Score

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.