From 7f9ec5dbb900d6c27fc59a2563fd2310794d1f0c Mon Sep 17 00:00:00 2001 From: Daniel Dervishi Date: Mon, 31 Jul 2023 17:37:28 -0400 Subject: [PATCH 1/2] Added documentation for criteria filtering and total mark ordering --- app/models/grouping.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/grouping.rb b/app/models/grouping.rb index 0c96d71cf3..7a266a6d0c 100644 --- a/app/models/grouping.rb +++ b/app/models/grouping.rb @@ -753,6 +753,11 @@ def get_random_incomplete(current_role) # float. 'max' is the maximum and 'min' is the minimum total mark a result should have. # +filter_data['totalExtraMarkRange']+ is a hash with the keys 'min' and 'max' each mapping to a string representing # a float. 'max' is the maximum and 'min' is the minimum total extra mark a result should have. + # +filter_data['criteria']+ is a list of hashes containing information about criteria to filter by. Each hash + # should contain a unique criterion name and can contain the keys 'min' and/or 'max' each mapping to a string + # representing a float. 'max' is the maximum and 'min' is the minimum grade for a given criterion a result should + # have. If both 'max' and 'min' are blank (a whitespace string/nil), filtering for the corresponding criterion will + # not occur. # To avoid filtering by any of the specified filters, don't set values for the corresponding key in +filter_data+ # or set it to nil. If the value for a key is blank (false, empty, or a whitespace string, as determined by # `.blank?`), no filtering will occur for the corresponding option. @@ -843,8 +848,8 @@ def filter_results(current_role, results, filter_data) # Orders the results, specified as +results+ by using +filter_data+ and returns the next grouping using +reversed+. # +reversed+ is a boolean value, true to return the next grouping and false to return the previous one. - # +filter_data['orderBy']+ specifies how the results should be ordered, with valid values being "group_name" and - # "submission_date". When this value is not specified (or nil), default ordering is applied. + # +filter_data['orderBy']+ specifies how the results should be ordered, with valid values being "group_name", + # "submission_date" and "total_mark". When this value is not specified (or nil), default ordering is applied. # +filter_data['ascending']+ specifies whether results should be ordered in ascending or descending order. Valid # options include "true" (corresponding to ascending order) or "false" (corresponding to descending order). When # this value is not specified (or nil), the results are ordered in ascending order. From a57347a5dba3f8580e993702e644ac38e8810e5a Mon Sep 17 00:00:00 2001 From: Daniel Dervishi Date: Mon, 31 Jul 2023 17:47:52 -0400 Subject: [PATCH 2/2] Updated documentation and fixed grammatical error --- app/models/grouping.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/grouping.rb b/app/models/grouping.rb index 7a266a6d0c..9b943c0eda 100644 --- a/app/models/grouping.rb +++ b/app/models/grouping.rb @@ -754,10 +754,10 @@ def get_random_incomplete(current_role) # +filter_data['totalExtraMarkRange']+ is a hash with the keys 'min' and 'max' each mapping to a string representing # a float. 'max' is the maximum and 'min' is the minimum total extra mark a result should have. # +filter_data['criteria']+ is a list of hashes containing information about criteria to filter by. Each hash - # should contain a unique criterion name and can contain the keys 'min' and/or 'max' each mapping to a string - # representing a float. 'max' is the maximum and 'min' is the minimum grade for a given criterion a result should - # have. If both 'max' and 'min' are blank (a whitespace string/nil), filtering for the corresponding criterion will - # not occur. + # should contain the key 'name' mapping to a string corresponding to the criterion name and can contain the keys + # 'min' and/or 'max' each mapping to a string representing a float. 'max' is the maximum and 'min' is the minimum + # grade for the given criterion a result should have. If both 'max' and 'min' are blank (a whitespace string/nil), + # filtering for the corresponding criterion will not occur. # To avoid filtering by any of the specified filters, don't set values for the corresponding key in +filter_data+ # or set it to nil. If the value for a key is blank (false, empty, or a whitespace string, as determined by # `.blank?`), no filtering will occur for the corresponding option.