Skip to content

Commit

Permalink
Use field courseid for logging events
Browse files Browse the repository at this point in the history
  • Loading branch information
melanietreitinger committed Mar 27, 2024
1 parent 33cbd05 commit 31120ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions classes/event/process_proceeded.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* - int processid: the id of the process.
* - int workflowid: the id of the workflow.
* - int stepindex: the index of the step.
* - int courseid: the id of the course.
* }
*
* @package tool_lifecycle
Expand All @@ -55,11 +54,11 @@ class process_proceeded extends \core\event\base {
public static function event_from_process($process) {
$data = [
'context' => \context_system::instance(),
'courseid' => $process->courseid,
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
'stepindex' => $process->stepindex,
'courseid' => $process->courseid,
],
];
return self::create($data);
Expand All @@ -84,7 +83,7 @@ public function get_description() {
$processid = $this->other['processid'];
$workflowid = $this->other['workflowid'];
$stepindex = $this->other['stepindex'];
$courseid = $this->other['courseid'];
$courseid = $this->courseid;

return "The workflow with id '$workflowid' finished step '$stepindex' successfully for course '$courseid' " .
"in the process with id '$processid'";
Expand Down Expand Up @@ -130,7 +129,7 @@ protected function validate_data() {
throw new \coding_exception('The \'stepindex\' value must be set');
}

if (!isset($this->other['courseid'])) {
if (!isset($this->courseid)) {
throw new \coding_exception('The \'courseid\' value must be set');
}
}
Expand Down
12 changes: 6 additions & 6 deletions classes/event/process_rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class process_rollback extends \core\event\base {
public static function event_from_process($process) {
$data = [
'context' => \context_system::instance(),
'courseid' => $process->courseid,
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
'stepindex' => $process->stepindex,
'courseid' => $process->courseid,
'processid' => $process->id,
'workflowid' => $process->workflowid,
'stepindex' => $process->stepindex,
],
];
return self::create($data);
Expand All @@ -84,7 +84,7 @@ public function get_description() {
$processid = $this->other['processid'];
$workflowid = $this->other['workflowid'];
$stepindex = $this->other['stepindex'];
$courseid = $this->other['courseid'];
$courseid = $this->courseid;

return "The workflow with id '$workflowid' was rolled back on step '$stepindex' for course '$courseid' " .
"in the process with id '$processid'";
Expand Down Expand Up @@ -130,7 +130,7 @@ protected function validate_data() {
throw new \coding_exception('The \'stepindex\' value must be set');
}

if (!isset($this->other['courseid'])) {
if (!isset($this->courseid)) {
throw new \coding_exception('The \'courseid\' value must be set');
}
}
Expand Down
6 changes: 3 additions & 3 deletions classes/event/process_triggered.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class process_triggered extends \core\event\base {
public static function event_from_process($process) {
$data = [
'context' => \context_system::instance(),
'courseid' => $process->courseid,
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
'courseid' => $process->courseid,
],
];
return self::create($data);
Expand All @@ -81,7 +81,7 @@ protected function init() {
public function get_description() {
$processid = $this->other['processid'];
$workflowid = $this->other['workflowid'];
$courseid = $this->other['courseid'];
$courseid = $this->courseid;

return "The workflow with id '$workflowid' triggered for course '$courseid' and created process with id '$processid'";
}
Expand Down Expand Up @@ -122,7 +122,7 @@ protected function validate_data() {
throw new \coding_exception('The \'workflowid\' value must be set');
}

if (!isset($this->other['courseid'])) {
if (!isset($this->courseid)) {
throw new \coding_exception('The \'courseid\' value must be set');
}
}
Expand Down

0 comments on commit 31120ff

Please sign in to comment.