Skip to content

Commit

Permalink
fix(*): fix the query to get the survey for user
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush8923 committed Aug 28, 2024
1 parent 0ab1470 commit d08cbf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/model/survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ protected static function get_survey_ids_for_user() {
if (is_student()) {
$params['role'] = '"' . get_user_role() . '"';
$user_grade = get_user_grade()->user_grade;
$params['grade'] = json_decode($user_grade, true);
$params['grade'] = $user_grade;

$sqlquery .= " AND JSON_CONTAINS(assigned_to, :role) AND JSON_CONTAINS(student_grade, :grade)";
} else if (is_teacher()){
$params['role'] = '"' . get_user_role() . '"';
$user_grade = get_user_grade()->user_grade;
$params['grade'] = json_decode($user_grade, true);
$params['grade'] = $user_grade;

$sqlquery .= "AND JSON_CONTAINS(assigned_to, :role) AND JSON_CONTAINS(teacher_grade, :grade)";
}
Expand Down

0 comments on commit d08cbf1

Please sign in to comment.