jeudi 30 septembre 2021

Clean Design | Quiz Responses Validation

Please suggest a clean design to validate a quizAttempt done on a quiz. There are multiple level of validations to be done

At Quiz Level:

  • TimeLimit Validation
  • Duplicate response validation

At Section Level:

  • TimeLimit Validation

At Question Level:

  • A non optional question not answered

  • A Prequisite question not answered

  • Invalid optionId

  • TimeLimit Validation

    QuizModel {    
        private List<QuizSection> sections;
        private Short marks;
        private Short seconds;
    }
    
     QuizSection{
         private Short marks;
         private Short seconds;
         List<Question> questions;
     }
    
     abstract Question{
         String question;
         private Short marks;
         private Short seconds;
         boolean optional;
         Question[] prerequisites;
     }
    
     MCQ extends Question{
        Options[] options
        Options[] correctAnswers
     }
    
     QuizAttempt{
         private String quizId;
         private String questionId;
         private long startTime;
         private long endTime;
         private long timeTaken;
         private List<QuestionAttempt> questionResponses;
         private UserIdentifier userIdentifiers;
         private Map<String,Object> quizForm;
     }
    

Aucun commentaire:

Enregistrer un commentaire