Skip to content

Commit

Permalink
Merge pull request #28 from gbarat87/update-text-data
Browse files Browse the repository at this point in the history
new setting for grader column
  • Loading branch information
marcusgreen authored Aug 20, 2024
2 parents efc7ad0 + 1d2109a commit a7b9195
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ jobs:
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none

- name: Install NVM and Node
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 20
nvm use 20
- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
Expand Down
4 changes: 3 additions & 1 deletion classes/btec.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public function get_data(\cm_info $cm) : array {
global $DB;
$sql = "SELECT gbf.id AS ggfid, crs.shortname AS course, asg.name AS assignment, asg.grade as gradeoutof, gd.name AS btec,
criteria.shortname, criteria.description as definition, criteria.description , gbf.score,
gbf.remark, gbf.criterionid, marker.username AS grader,
gbf.remark, gbf.criterionid, marker.username AS graderusername,
marker.firstname AS graderfirstname, marker.lastname AS graderlastname,
marker.email AS graderemail,
stu.id AS userid, stu.idnumber AS idnumber, stu.firstname, stu.lastname,
stu.username AS username, gin.timemodified AS modified,ag.id, ag.grade,
assign_comment.commenttext as overallfeedback
Expand Down
4 changes: 3 additions & 1 deletion classes/guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public function get_data(\assign $assign, \cm_info $cm) :array {
$sql = "SELECT fillings.id AS ggfid, cm.course AS course, asg.name AS assignment,
asg.grade as gradeoutof,gd.name AS guide,
criteria.description,criteria.shortname,
fillings.score, fillings.remark, fillings.criterionid, rubm.username AS grader,
fillings.score, fillings.remark, fillings.criterionid, rubm.username AS graderusername,
rubm.firstname AS graderfirstname, rubm.lastname AS graderlastname,
rubm.email AS graderemail,
stu.id AS userid, stu.idnumber AS idnumber, stu.firstname, stu.lastname,
stu.username, stu.email, ag.timemodified AS modified, ag.grade,
assign_comment.commenttext as overallfeedback
Expand Down
4 changes: 3 additions & 1 deletion classes/rubref.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public function get_data(\assign $assign, \cm_info $cm) : array {
level.definition, grf.remark, grf.criterionid,
stu.id AS userid, stu.idnumber AS idnumber,
stu.firstname, stu.lastname, stu.username,
stu.username, stu.email, rubm.username AS grader,
stu.username, stu.email, rubm.username AS graderusername,
rubm.firstname AS graderfirstname, rubm.lastname AS graderlastname,
rubm.email AS graderemail,
gin.timemodified AS modified,
ctx.instanceid, ag.grade, asg.blindmarking, assign_comment.commenttext as overallfeedback
FROM {assign} asg
Expand Down
4 changes: 3 additions & 1 deletion classes/rubric.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public function get_data(\assign $assign, \cm_info $cm) : array {
level.definition, grf.remark, grf.criterionid,
stu.id AS userid, stu.idnumber AS idnumber,
stu.firstname, stu.lastname, stu.username,
stu.username, stu.email, rubm.username AS grader,
stu.username, stu.email, rubm.username AS graderusername,
rubm.firstname AS graderfirstname, rubm.lastname AS graderlastname,
rubm.email AS graderemail,
ag.timemodified AS modified,
ctx.instanceid, ag.grade, asg.blindmarking, assign_comment.commenttext as overallfeedback
FROM {assign} asg
Expand Down
4 changes: 3 additions & 1 deletion classes/rubric_ranges.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public function get_data(\assign $assign, \cm_info $cm): array {
level.definition, grf.remark, grf.grade as grade_rub_range, grf.criterionid,
stu.id AS userid, stu.idnumber AS idnumber,
stu.firstname, stu.lastname, stu.username,
stu.username, stu.email, rubm.username AS grader,
stu.username, stu.email, rubm.username AS graderusername,
rubm.firstname AS graderfirstname, rubm.lastname AS graderlastname,
rubm.email AS graderemail,
ag.timemodified AS modified,
ctx.instanceid, ag.grade, asg.blindmarking, assign_comment.commenttext as overallfeedback
FROM {assign} asg
Expand Down
10 changes: 8 additions & 2 deletions lang/en/report_advancedgrading.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
$string['btecgrades'] = 'BTEC breakdown report';
$string['rubricgrades'] = 'Rubric breakdown report';
$string['guidegrades'] = 'Marking guide breakdown report';
$string['rubricrangesgrades'] = 'rubric range breakdown report';
$string['rubricrangesgrades'] = 'Rubric range breakdown report';
$string['rubric'] = 'Rubric';
$string['assignment'] = 'Assignment';
$string['grademethod'] = 'Grade method';
Expand All @@ -36,7 +36,7 @@
$string['showgroups'] = 'Show groups';
$string['showgroups_desc'] = 'Show groups in the report';
$string['exceldownload'] = 'Excel download';
$string['exceldownload_help'] = 'Download an Excel spreaedsheet format (xlsx) version of the table';
$string['exceldownload_help'] = 'Download an Excel spreadsheet format (xlsx) version of the table';
$string['csvdownload'] = 'CSV download';
$string['csvdownload_help'] = 'Download a comma Separated values version of the table';
$string['profilefields'] = 'Profile fields';
Expand All @@ -61,3 +61,9 @@
$string['viewsubmissions_help'] = 'View submissions';
$string['enable_javascriptlayout'] = 'Enable javascript layout';
$string['enable_javascriptlayout_desc'] = 'Adds paging and sorting to the table layout, may add a performance overhead';
$string['profilefieldsgradeby'] = 'Profile fields graded by';
$string['profilefieldsgradeby_desc'] = 'Additional user fields shown in report for column \'Graded By\'';
$string['graderusername'] = 'Username';
$string['graderfirstname'] = 'First name';
$string['graderlastname'] = 'Last name';
$string['graderemail'] = 'Email address';
18 changes: 17 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function get_grades(array $data, array $dbrecords): array {

$gi = [
'overallfeedback' => $grade->overallfeedback,
'grader' => $grade->grader,
'grader' => gradedbydata($grade),
'timegraded' => $grade->modified,
'grade' => $formattedgrade
];
Expand Down Expand Up @@ -418,3 +418,19 @@ function output_header(string $filename, string$filetype) : bool {
header('Content-Disposition: attachment;filename="' . $filename);
return true;
}

/**
* Return the data for the graded by column following the config.
*
* @param array $gradedata
* @return string The corresponding data from the settings.
*/
function gradedbydata($gradedata): string {
$graderprofileconfig = trim(get_config('report_advancedgrading', 'profilefieldsgradeby'));
$gradedbyfields = empty($graderprofileconfig) ? [] : explode(',', $graderprofileconfig);
$fielddata = [];
foreach ($gradedbyfields as $field) {
$fielddata[] = $gradedata->$field;
}
return implode(' - ', $fielddata);
}
19 changes: 19 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,23 @@
['username' => 1],
$choices
));

$rawchoicesgradeby = [
'graderusername',
'graderfirstname',
'graderlastname',
'graderemail',
];
$choices = [];
foreach ($rawchoicesgradeby as $choice) {
$choices[$choice] = new lang_string($choice, 'report_advancedgrading');
}

$settings->add(new admin_setting_configmulticheckbox(
'report_advancedgrading/profilefieldsgradeby',
new lang_string('profilefieldsgradeby', 'report_advancedgrading'),
new lang_string('profilefieldsgradeby_desc', 'report_advancedgrading'),
['graderusername' => 1],
$choices
));
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2024030400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024081900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021051715; // Moodle 3.11.
$plugin->release = '1.0';
$plugin->supported = [311, 404];
Expand Down

0 comments on commit a7b9195

Please sign in to comment.