Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTP-3057, CTP-3094, CTP-3095 #35

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apiclients/easikit/classes/requests/getcomponentgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function process_response($response): array {
'MAB_SEQ' => $value['sequence_number'],
'AST_CODE' => $value['assessment_component_type']['code'],
'MAB_PERC' => $matches[1],
'MAB_NAME' => $value['name'],
'MAB_NAME' => preg_replace('/\s*\(\d+%?\)$/', '', $value['name']),
'MKS_CODE' => $value['mark_scheme']['code'],
'APA_ROMC' => $value['schedule']['location']['room']['identifier'],
];
Expand Down
3 changes: 2 additions & 1 deletion classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ public function get_transfer_logs (int $assessmentmappingid, int $userid, string
}

// Get the latest record for each push type, e.g. grade push, submission log push.
$sql = "SELECT t1.id, t1.type, t1.request, t1.response, t1.timecreated, t1.errlogid, errlog.errortype, errlog.message
$sql = "SELECT t1.id, t1.type, t1.request, t1.response, t1.requestbody, t1.timecreated, t1.errlogid,
errlog.errortype, errlog.message
FROM {" . self::TABLE_TRANSFER_LOG . "} t1
INNER JOIN (
SELECT type, assessmentmappingid, MAX(timecreated) AS latest_time
Expand Down
12 changes: 12 additions & 0 deletions classes/output/pushrecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class pushrecord {
/** @var bool Is submission log pushed */
public bool $issublogpushed = false;

/** @var bool Is marks updated after transfer */
public bool $marksupdatedaftertransfer = false;

/** @var string Transferred mark */
public string $transferredmark = '-';

/** @var manager|null Grade push manager */
protected ?manager $manager;

Expand Down Expand Up @@ -188,6 +194,12 @@ protected function set_transfer_records(int $assessmentmappingid, int $studentid
$this->componentgrade = $matches[1];
}
if ($log->type == manager::PUSH_GRADE) {
// Check if marks updated after transfer.
if ($response->code == '0') {
$requestbody = json_decode($log->requestbody);
$this->transferredmark = $requestbody->actual_mark;
$this->marksupdatedaftertransfer = $this->marks != $requestbody->actual_mark;
}
$this->lastgradepushresult = $result;
$this->lastgradepusherrortype = $errortype;
$this->lastgradepushtime = $timecreated;
Expand Down
2 changes: 2 additions & 0 deletions lang/en/local_sitsgradepush.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
$string['index:submissiondate'] = 'Submission date';
$string['index:lastmarktransfer'] = 'Mark Transferred';
$string['index:lastsublogtransfer'] = 'Submission Date recorded in SITS';
$string['index:mark_changed_to'] = 'Mark changed to {$a}';

// Marks transfer dashboard page.
$string['dashboard:header'] = 'SITS assessment mapping and mark transfer';
Expand All @@ -92,6 +93,7 @@
$string['dashboard:seq'] = 'SEQ';
$string['dashboard:sits_assessment'] = 'SITS assessment';
$string['dashboard:weight'] = 'Weight';
$string['dashboard:mab_perc'] = '{$a}%';
$string['dashboard:asttype'] = 'AST TYPE';
$string['dashboard:source'] = 'Source';
$string['dashboard:moodle_activity'] = 'Moodle activity';
Expand Down
9 changes: 4 additions & 5 deletions templates/dashboard.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<table class="module-delivery-table table table-bordered mb-5">
<thead class="thead-light">
<tr class="small">
<th>{{#str}} dashboard:seq, local_sitsgradepush {{/str}}</th>
<th>{{#str}} dashboard:sits_assessment, local_sitsgradepush {{/str}}</th>
<th>{{#str}} dashboard:weight, local_sitsgradepush {{/str}}</th>
<th>{{#str}} dashboard:moodle_activity, local_sitsgradepush {{/str}}</th>
Expand All @@ -138,11 +139,9 @@
<tbody>
{{#componentgrades}}
<tr>
<th scope="row">
<span class="badge badge-dark">{{mabseq}}</span>
{{mabname}}
</th>
<td>{{mabperc}}</td>
<td>{{mabseq}}</td>
<td>{{mabname}}</td>
<td>{{#str}} dashboard:mab_perc, local_sitsgradepush, {{mabperc}} {{/str}}</td>
<td>
{{#assessmentmapping}}
<p>
Expand Down
11 changes: 9 additions & 2 deletions templates/marks_transfer_history_table.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"firstname":"Test",
"lastname":"User",
"idnumber":"1234567",
"marks":"0",
"marksupdatedaftertransfer":"true",
"transferredmark":"77",
"marks":"66",
"handindatetime":"2019-01-01 00:00:00",
"lastgradepushresultlabel":"<span class=\"badge badge-success\">Success</span> ",
"lastgradepushtime":"2019-01-01 00:00:00",
Expand Down Expand Up @@ -80,7 +82,12 @@
<tr>
<th scope="row">{{firstname}} {{lastname}}</th>
<td>{{idnumber}}</td>
<td>{{marks}}</td>
<td>{{^marksupdatedaftertransfer}}{{marks}}{{/marksupdatedaftertransfer}}
{{#marksupdatedaftertransfer}}
{{transferredmark}}<br>
<span class="badge badge-danger">{{#str}} index:mark_changed_to, local_sitsgradepush, {{marks}} {{/str}}</span>
{{/marksupdatedaftertransfer}}
</td>
<td>{{handindatetime}}</td>
<td>{{{lastgradepushresultlabel}}}{{lastgradepushtime}}</td>
{{#showsublogcolumn}}
Expand Down
Loading