From f06b9ea647cfc3f4346ad5da866a07d3a4c7dba7 Mon Sep 17 00:00:00 2001 From: MENGYEWGAU_UBUNTU Date: Mon, 9 Oct 2023 13:31:29 +0800 Subject: [PATCH] Fixed some linting errors --- .../api/v1/submission_similarities_controller.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/v1/submission_similarities_controller.rb b/app/controllers/api/v1/submission_similarities_controller.rb index d70a4e2d..eef72afd 100644 --- a/app/controllers/api/v1/submission_similarities_controller.rb +++ b/app/controllers/api/v1/submission_similarities_controller.rb @@ -70,19 +70,20 @@ def render_submission_similarities render json: { status: 'processing' }, status: :ok return when SubmissionSimilarityProcess::STATUS_ERRONEOUS - render json: { status: 'error', message: 'SSID is busy or under maintenance. Please try again later.' }, status: :service_unavailable + render json: { status: 'error', message: 'SSID is busy or under maintenance. Please try again later.' }, + status: :service_unavailable return end submission_similarities = assignment.submission_similarities - ### Filtering Code + ### Filtering Code # Apply the threshold filter if params[:threshold].present? threshold_value = params[:threshold].to_f submission_similarities = submission_similarities.where('similarity >= ?', threshold_value) end - + # Apply the limit filter if params[:limit].present? limit_value = params[:limit].to_i @@ -91,15 +92,14 @@ def render_submission_similarities # Apply the page filter if params[:page].present? - per_page = params[:limit].present? ?limit_value : 20 # Default per page value is 20, limit to use a page size + per_page = params[:limit].present? ? limit_value : 20 # Default per page value is 20, limit to use a page size page_number = params[:page].to_i submission_similarities = submission_similarities.offset(per_page * (page_number - 1)) end - - render json: { status: "processed", submissionSimilarities: submission_similarities }, status: :ok + render json: { status: 'processed', submissionSimilarities: submission_similarities }, status: :ok end - + def render_pair_of_flagged_submissions submission_similarity = SubmissionSimilarity.find_by( assignment_id: params[:assignment_id],