Skip to content

Commit

Permalink
Merge pull request #115 from correctexam/develop
Browse files Browse the repository at this point in the history
update query to support anonymous correction
  • Loading branch information
barais authored Jan 3, 2024
2 parents e369c6a + 7e31c6e commit e7dfe75
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/main/java/fr/istic/domain/StudentResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,36 +239,36 @@ public static PanacheQuery<StudentResponse> getAll4ExamIdEvenOrphan( long examId


public static PanacheQuery<ExamSheet> getBestAnswerforQuestionNoAndExamId( long examId, int questionNo) {
return find("select distinct sr.sheet from StudentResponse sr where sr.question.numero = ?2 and sr.question.exam.id = ?1 and sr.star = true and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1 and sr.sheet.students IS NOT EMPTY",examId,questionNo );
return find("select distinct sr.sheet from StudentResponse sr where sr.question.numero = ?2 and sr.question.exam.id = ?1 and sr.star = true and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1",examId,questionNo );
}


public static PanacheQuery<StudentResponse> findAllByQuestionId( long questionId) {
return find("select distinct sr from StudentResponse sr where sr.question.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1 and sr.sheet.students IS NOT EMPTY ",questionId );
return find("select distinct sr from StudentResponse sr where sr.question.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1",questionId );
}

public static PanacheQuery<StudentResponse> findAllByQuestionIdfetchAnswerfetchHybridCommand( long questionId) {
return find("select distinct sr from StudentResponse sr join fetch sr.hybridcommentsValues ah join fetch ah.hybridcomments h2 where sr.question.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1 and sr.sheet.students IS NOT EMPTY ",questionId );
return find("select distinct sr from StudentResponse sr join fetch sr.hybridcommentsValues ah join fetch ah.hybridcomments h2 where sr.question.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1",questionId );
}




public static PanacheQuery<StudentResponse> findAllByGradedCommentsIds( long gradedCommentid) {
return find("select distinct sr from StudentResponse sr join sr.gradedcomments gc where gc.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1 and sr.sheet.students IS NOT EMPTY",gradedCommentid );
return find("select distinct sr from StudentResponse sr join sr.gradedcomments gc where gc.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1",gradedCommentid );
}
public static PanacheQuery<StudentResponse> findAllByTextCommentsIds( long textcommentsid) {
return find("select distinct sr from StudentResponse sr join sr.textcomments gc where gc.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1 and sr.sheet.students IS NOT EMPTY",textcommentsid );
return find("select distinct sr from StudentResponse sr join sr.textcomments gc where gc.id = ?1 and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1",textcommentsid );
}



public static PanacheQuery<StudentResponse> getAllBestAnswerforExamId( long examId) {
return find("select distinct sr from StudentResponse sr join fetch sr.question join fetch sr.sheet where sr.question.exam.id = ?1 and sr.star = true and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1 and sr.sheet.students IS NOT EMPTY",examId );
return find("select distinct sr from StudentResponse sr join fetch sr.question join fetch sr.sheet where sr.question.exam.id = ?1 and sr.star = true and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1",examId );
}

public static PanacheQuery<StudentResponse> getAllWorstAnswerforExamId( long examId) {
return find("select distinct sr from StudentResponse sr join fetch sr.question join fetch sr.sheet where sr.question.exam.id = ?1 and sr.worststar = true and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1 and sr.sheet.students IS NOT EMPTY",examId );
return find("select distinct sr from StudentResponse sr join fetch sr.question join fetch sr.sheet where sr.question.exam.id = ?1 and sr.worststar = true and sr.sheet.pagemin <> -1 and sr.sheet.pagemax <> -1",examId );
}


Expand All @@ -277,32 +277,32 @@ public static PanacheQuery<StudentResponse> getAllStudentResponse4QidNotInRespon
}

public static PanacheQuery<StudentResponse> getAllStudentResponse4examIdGradedCommentId(long examId, long gradedCommentid) {
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone join fetch sheet.students left join fetch sr.gradedcomments gc1 join sr.gradedcomments gc where sr.question.exam.id = ?1 and gc.id = ?2 and sheet.pagemin <> -1 and sheet.pagemax <> -1 and sheet.students IS NOT EMPTY",examId,gradedCommentid );
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone left join fetch sheet.students left join fetch sr.gradedcomments gc1 join sr.gradedcomments gc where sr.question.exam.id = ?1 and gc.id = ?2 and sheet.pagemin <> -1 and sheet.pagemax <> -1",examId,gradedCommentid );
}

public static PanacheQuery<Answer2HybridGradedComment> getAllStudentResponse4examIdHybridCommentId(long examId, long hybridCommentid, int stepValue) {
return find("select distinct an from Answer2HybridGradedComment an join fetch an.studentResponse as sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone join fetch sheet.students join fetch an.hybridcomments hc where sr.question.exam.id = ?1 and hc.id = ?2 and an.stepValue=?3 and sheet.pagemin <> -1 and sheet.pagemax <> -1 and sheet.students IS NOT EMPTY",examId,hybridCommentid,stepValue );
return find("select distinct an from Answer2HybridGradedComment an join fetch an.studentResponse as sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone left join fetch sheet.students join fetch an.hybridcomments hc where sr.question.exam.id = ?1 and hc.id = ?2 and an.stepValue=?3 and sheet.pagemin <> -1 and sheet.pagemax <> -1",examId,hybridCommentid,stepValue );
}


public static PanacheQuery<StudentResponse> getAllStudentResponse4examIdTextCommentId(long examId, long textCommentid) {
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone join fetch sheet.students left join fetch sr.textcomments tc1 join sr.textcomments tc where sr.question.exam.id = ?1 and tc.id = ?2 and sheet.pagemin <> -1 and sheet.pagemax <> -1 and sheet.students IS NOT EMPTY",examId,textCommentid );
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone left join fetch sheet.students left join fetch sr.textcomments tc1 join sr.textcomments tc where sr.question.exam.id = ?1 and tc.id = ?2 and sheet.pagemin <> -1 and sheet.pagemax <> -1",examId,textCommentid );
}

public static PanacheQuery<StudentResponse> getAllStudentResponseWithSameGrade4examIdRespId(long examId, long respId) {
StudentResponse sr = findById(respId);
var s = sr.quarternote;
var qid = sr.question.id;
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sr.quarternote = ?2 and q.id = ?3 and sheet.pagemin <> -1 and sheet.pagemax <> -1 and sheet.students IS NOT EMPTY",examId,s,qid);
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone left join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sr.quarternote = ?2 and q.id = ?3 and sheet.pagemin <> -1 and sheet.pagemax <> -1",examId,s,qid);
}

public static PanacheQuery<StudentResponse> getAllStudentResponseWithExamIdNumeroAndSheetId(long examId, int numero, long sheetid) {
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sr.question.numero = ?2 and sheet.id = ?3 and sheet.pagemin <> -1 and sheet.pagemax <> -1 and sheet.students IS NOT EMPTY",examId,numero,sheetid);
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone left join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sr.question.numero = ?2 and sheet.id = ?3 and sheet.pagemin <> -1 and sheet.pagemax <> -1",examId,numero,sheetid);
}


public static PanacheQuery<StudentResponse> getAllStudentResponseWithexamId(long examId) {
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sheet.pagemin <> -1 and sheet.pagemax <> -1 and sheet.students IS NOT EMPTY",examId);
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone left join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sheet.pagemin <> -1 and sheet.pagemax <> -1",examId);
}


Expand All @@ -312,7 +312,7 @@ public static PanacheQuery<StudentResponse> getAllStudentResponseWithexamIdWithO


public static PanacheQuery<StudentResponse> getAllStudentResponseWithexamIdAndSheetName(long examId,String sheetname) {
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sheet.name = ?2 and sheet.pagemin <> -1 and sheet.pagemax <> -1 and sheet.students IS NOT EMPTY",examId,sheetname);
return find("select distinct sr from StudentResponse sr join fetch sr.sheet as sheet join fetch sr.question as q join fetch q.zone left join fetch sheet.students left join fetch sr.textcomments tc left join fetch sr.gradedcomments gc where sr.question.exam.id = ?1 and sheet.name = ?2 and sheet.pagemin <> -1 and sheet.pagemax <> -1",examId,sheetname);
}


Expand Down

0 comments on commit e7dfe75

Please sign in to comment.