Skip to content
Snippets Groups Projects
Unverified Commit 35ae5f78 authored by Ryan Smith's avatar Ryan Smith Committed by GitHub
Browse files

fix: Improves assignment activity for #186. (#206)

parent 9efbac35
No related branches found
No related tags found
No related merge requests found
Showing with 64 additions and 20 deletions
......@@ -64,7 +64,7 @@ function assignment_graded(array $config, \stdClass $event) {
$lang => 'attained grade for'
],
],
'object' => utils\get_activity\module($config, 'assign', $assignment, $lang),
'object' => utils\get_activity\course_assignment($config, $event->contextinstanceid, $assignment->name, $lang),
'result' => [
'score' => [
'raw' => $scoreraw,
......@@ -84,9 +84,6 @@ function assignment_graded(array $config, \stdClass $event) {
utils\INFO_EXTENSION => utils\get_info($config, $event),
],
'contextActivities' => [
'other' => [
utils\get_activity\event_module($config, $event, $lang)
],
'grouping' => [
utils\get_activity\site($config),
utils\get_activity\course($config, $course)
......
......@@ -24,6 +24,8 @@ function assignment_submitted(array $config, \stdClass $event) {
$repo = $config['repo'];
$user = $repo->read_record_by_id('user', $event->userid);
$course = $repo->read_record_by_id('course', $event->courseid);
$assignmentsubmission = $repo->read_record_by_id('assign_submission', $event->objectid);
$assignment = $repo->read_record_by_id('assign', $assignmentsubmission->assignment);
$lang = utils\get_course_lang($course);
return [[
......@@ -34,7 +36,7 @@ function assignment_submitted(array $config, \stdClass $event) {
$lang => 'submitted'
],
],
'object' => utils\get_activity\event_module($config, $event, $lang),
'object' => utils\get_activity\course_assignment($config, $event->contextinstanceid, $assignment->name, $lang),
'timestamp' => utils\get_event_timestamp($event),
'context' => [
'platform' => $config['source_name'],
......
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace src\transformer\utils\get_activity;
defined('MOODLE_INTERNAL') || die();
use src\transformer\utils as utils;
function course_assignment(array $config, $cmid, $name, $lang) {
return [
'id' => $config['app_url'].'/mod/assign/view.php?id='.$cmid,
'definition' => [
'type' => 'http://adlnet.gov/expapi/activities/assessment',
'name' => [
$lang => $name,
],
],
];
}
......@@ -18,6 +18,14 @@
"lang": "en"
}
],
"course_modules": [
{
"id": 1,
"course": 1,
"module": 1,
"instance": 1
}
],
"assign": [
{
"id": 1,
......
......@@ -5,5 +5,6 @@
"timecreated": 1433946701,
"objecttable": "grade",
"objectid": 1,
"contextinstanceid": 1,
"eventname": "\\mod_assign\\event\\submission_graded"
}
\ No newline at end of file
......@@ -16,7 +16,7 @@
"object": {
"id": "http:\/\/www.example.org\/mod\/assign\/view.php?id=1",
"definition": {
"type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module",
"type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment",
"name": {
"en": "test_name"
}
......@@ -52,17 +52,6 @@
}
},
"contextActivities": {
"other": [
{
"id": "http:\/\/www.example.org\/mod\/grade\/view.php?id=1",
"definition": {
"type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module",
"name": {
"en": "grade"
}
}
}
],
"grouping": [
{
"id": "http:\/\/www.example.org",
......
......@@ -13,7 +13,21 @@
"lang": "en"
}
],
"assignment_submissions": [
"course_modules": [
{
"id": 1,
"course": 1,
"module": 1,
"instance": 1
}
],
"assign_submission": [
{
"id": 1,
"assignment": 1
}
],
"assign": [
{
"id": 1,
"name": "test_name"
......
......@@ -5,5 +5,6 @@
"timecreated": 1433946701,
"objecttable": "assignment_submissions",
"objectid": 1,
"contextinstanceid": 1,
"eventname": "\\mod_assign\\event\\assessable_submitted"
}
\ No newline at end of file
......@@ -14,9 +14,9 @@
}
},
"object": {
"id": "http:\/\/www.example.org\/mod\/assignment_submissions\/view.php?id=1",
"id": "http:\/\/www.example.org\/mod\/assign\/view.php?id=1",
"definition": {
"type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module",
"type": "http:\/\/adlnet.gov\/expapi\/activities\/assessment",
"name": {
"en": "test_name"
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment