Class QuizAttemptHome
java.lang.Object
fr.paris.lutece.plugins.wiki.modules.quiz.business.QuizAttemptHome
Home class for QuizAttempt providing static service methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcountAttemptsByQuizAndUser(int nIdQuiz, String strUserGuid) Counts the number of attempts for a specific quiz by a specific user.static QuizAttemptcreate(QuizAttempt attempt) Creates a new quiz attempt in the database.static Optional<QuizAttempt>findByPrimaryKey(int nKey) Retrieves a quiz attempt by its primary key.static List<QuizAttempt>getAttemptsByQuiz(int nIdQuiz) Retrieves all attempts for a specific quiz.static List<QuizAttempt>getAttemptsByQuizAndUser(int nIdQuiz, String strUserGuid) Retrieves all attempts for a specific quiz by a specific user.static QuizAttemptupdate(QuizAttempt attempt) Updates an existing quiz attempt in the database.
-
Method Details
-
create
Creates a new quiz attempt in the database.- Parameters:
attempt- The quiz attempt to create- Returns:
- The created quiz attempt with its ID set
-
update
Updates an existing quiz attempt in the database.- Parameters:
attempt- The quiz attempt to update- Returns:
- The updated quiz attempt
-
findByPrimaryKey
Retrieves a quiz attempt by its primary key.- Parameters:
nKey- The attempt ID- Returns:
- An optional containing the quiz attempt if found
-
getAttemptsByQuiz
Retrieves all attempts for a specific quiz.- Parameters:
nIdQuiz- The quiz ID- Returns:
- A list of quiz attempts for the quiz
-
getAttemptsByQuizAndUser
Retrieves all attempts for a specific quiz by a specific user.- Parameters:
nIdQuiz- The quiz IDstrUserGuid- The user GUID- Returns:
- A list of quiz attempts for the quiz and user
-
countAttemptsByQuizAndUser
Counts the number of attempts for a specific quiz by a specific user.- Parameters:
nIdQuiz- The quiz IDstrUserGuid- The user GUID- Returns:
- The count of attempts
-