Skip to content

Commit

Permalink
CTP-3057 Add badge to updated marks after transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
aydevworks committed Feb 7, 2024
1 parent 3e69f34 commit 8ea77b1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ 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
1 change: 1 addition & 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 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

0 comments on commit 8ea77b1

Please sign in to comment.