Skip to content

Commit

Permalink
more useful refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
milt committed Oct 10, 2024
1 parent 7834a44 commit cdeeea2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/transformer/events/core/course_section_created.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ function course_section_created(array $config, \stdClass $event) {
$user = $repo->read_record_by_id('user', $event->userid);
$course = $repo->read_record_by_id('course', $event->courseid);
$lang = utils\get_course_lang($course);
$section = $repo->read_record_by_id($event->objecttable, $event->objectid);

return [[
'actor' => utils\get_user($config, $user),
Expand All @@ -48,7 +47,7 @@ function course_section_created(array $config, \stdClass $event) {
$lang => 'Created',
],
],
'object' => utils\get_activity\course_section($config, $course, $section),
'object' => utils\get_activity\course_section($config, $course, $event->objectid),
'context' => [
'extensions' => utils\extensions\base($config, $event, null),
'contextActivities' => [
Expand Down
5 changes: 3 additions & 2 deletions src/transformer/utils/get_activity/course_section.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
*
* @param array $config The transformer config settings.
* @param \stdClass $course The course object.
* @param \stdClass $section The course section.
* @param int $csid The course section id.
* @return array
*/
function course_section(array $config, \stdClass $course, \stdClass $section) {
function course_section(array $config, \stdClass $course, int $csid) {
$lang = utils\get_course_lang($course);
$section = $repo->read_record_by_id('course_sections', $csid);

return [
'id' => $config['app_url'] . '/course/section.php?id=' . $section->id,
Expand Down

0 comments on commit cdeeea2

Please sign in to comment.