Skip to content

Commit

Permalink
MDL-60072 mod: Fix bad event naming
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 16, 2017
1 parent d8e9a23 commit f10721d
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 25 deletions.
10 changes: 5 additions & 5 deletions blocks/myoverview/tests/behat/block_myoverview_dashboard.feature
Expand Up @@ -32,20 +32,20 @@ Feature: The my overview block allows users to easily access their courses and s
And I click on "Timeline" "link" in the "Course overview" "block"
When I click on "Sort by dates" "link" in the "Course overview" "block"
Then I should see "Next 7 days" in the "Course overview" "block"
And I should see "Choice Test choice 1 closes" in the "Course overview" "block"
And I should see "Test choice 1 closes" in the "Course overview" "block"
And I should see "View choices" in the "Course overview" "block"
And I should see "Feedback Test feedback 1 closes" in the "Course overview" "block"
And I should see "Test feedback 1 closes" in the "Course overview" "block"
And I should see "Answer the questions" in the "Course overview" "block"
And I should see "Future" in the "Course overview" "block"
And I should see "Choice Test choice 3 closes" in the "Course overview" "block"
And I should see "Feedback Test feedback 3 closes" in the "Course overview" "block"
And I should see "Test choice 3 closes" in the "Course overview" "block"
And I should see "Test feedback 3 closes" in the "Course overview" "block"
And I log out

Scenario: Past activities should not be displayed on the timeline view
Given I log in as "student1"
And I click on "Timeline" "link" in the "Course overview" "block"
When I click on "Sort by dates" "link" in the "Course overview" "block"
And I should not see "Choice Test choice 2 closes" in the "Course overview" "block"
And I should not see "Test choice 2 closes" in the "Course overview" "block"
And I log out

Scenario: See the courses I am enrolled by their status on courses view
Expand Down
Expand Up @@ -24,7 +24,7 @@ Feature: Course overview block show users their progress on courses
Given I log in as "student1"
And I click on "Timeline" "link" in the "Course overview" "block"
When I click on "Sort by courses" "link" in the "Course overview" "block"
Then I should see "Choice Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
Then I should see "Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
And I should not see "0%" in the "Course overview" "block"
And I click on "Courses" "link" in the "Course overview" "block"
And I click on "In progress" "link" in the "Course overview" "block"
Expand All @@ -44,7 +44,7 @@ Feature: Course overview block show users their progress on courses
And I log out
And I log in as "student1"
And I click on "Sort by courses" "link" in the "Course overview" "block"
And I should see "Choice Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
And I should see "Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
And I should see "0%" in the "Course overview" "block"
And I click on "Courses" "link" in the "Course overview" "block"
When I click on "In progress" "link" in the "Course overview" "block"
Expand Down
15 changes: 15 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -2601,5 +2601,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017092900.00);
}

if ($oldversion < 2017100800.00) {
// Create adhoc task for upgrading of existing calendar events.
$record = new \stdClass();
$record->classname = '\core\task\refresh_mod_calendar_events_task';
$record->component = 'core';

// Next run time based from nextruntime computation in \core\task\manager::queue_adhoc_task().
$nextruntime = time() - 1;
$record->nextruntime = $nextruntime;
$DB->insert_record('task_adhoc', $record);

// Main savepoint reached.
upgrade_main_savepoint(true, 2017100800.00);
}

return true;
}
2 changes: 2 additions & 0 deletions mod/assign/lang/en/assign.php
Expand Up @@ -105,6 +105,8 @@
$string['blindmarking'] = 'Blind marking';
$string['blindmarkingenabledwarning'] = 'Blind marking is enabled for this activity.';
$string['blindmarking_help'] = 'Blind marking hides the identity of students from markers. Blind marking settings will be locked once a submission or grade has been made in relation to this assignment.';
$string['calendardue'] = '{$a} is due';
$string['calendargradingdue'] = '{$a} is due to be graded';
$string['changeuser'] = 'Change user';
$string['changefilters'] = 'Change filters';
$string['choosegradingaction'] = 'Grading action';
Expand Down
3 changes: 2 additions & 1 deletion mod/assign/locallib.php
Expand Up @@ -1162,7 +1162,6 @@ public function update_calendar($coursemoduleid) {
$event->groupid = 0;
$event->userid = 0;
$event->instance = $instance->id;
$event->name = $instance->name;
$event->type = CALENDAR_EVENT_TYPE_ACTION;

// Convert the links to pluginfile. It is a bit hacky but at this stage the files
Expand All @@ -1189,6 +1188,7 @@ public function update_calendar($coursemoduleid) {

$eventtype = ASSIGN_EVENT_TYPE_DUE;
if ($instance->duedate) {
$event->name = get_string('calendardue', 'assign', $instance->name);
$event->eventtype = $eventtype;
$event->timestart = $instance->duedate;
$event->timesort = $instance->duedate;
Expand All @@ -1214,6 +1214,7 @@ public function update_calendar($coursemoduleid) {

$eventtype = ASSIGN_EVENT_TYPE_GRADINGDUE;
if ($instance->gradingduedate) {
$event->name = get_string('calendargradingdue', 'assign', $instance->name);
$event->eventtype = $eventtype;
$event->timestart = $instance->gradingduedate;
$event->timesort = $instance->gradingduedate;
Expand Down
4 changes: 2 additions & 2 deletions mod/choice/lang/en/choice.php
Expand Up @@ -27,8 +27,8 @@
$string['allowupdate'] = 'Allow choice to be updated';
$string['allowmultiple'] = 'Allow more than one choice to be selected';
$string['answered'] = 'Answered';
$string['calendarend'] = 'Choice {$a} closes';
$string['calendarstart'] = 'Choice {$a} opens';
$string['calendarend'] = '{$a} closes';
$string['calendarstart'] = '{$a} opens';
$string['cannotsubmit'] = 'Sorry, there was a problem submitting your choice. Please try again.';
$string['closebeforeopen'] = 'You have specified a close date before the open date.';
$string['completionsubmit'] = 'Show as complete when user makes a choice';
Expand Down
4 changes: 2 additions & 2 deletions mod/data/lang/en/data.php
Expand Up @@ -54,8 +54,8 @@
$string['blank'] = 'Blank';
$string['buttons'] = 'Actions';
$string['bynameondate'] = 'by {$a->name} - {$a->date}';
$string['calendarend'] = 'Database {$a} closes';
$string['calendarstart'] = 'Database {$a} opens';
$string['calendarend'] = '{$a} closes';
$string['calendarstart'] = '{$a} opens';
$string['cancel'] = 'Cancel';
$string['cannotaccesspresentsother'] = 'You are not allowed to access presets from other users';
$string['cannotadd'] = 'Can not add entries!';
Expand Down
4 changes: 2 additions & 2 deletions mod/feedback/lang/en/feedback.php
Expand Up @@ -38,8 +38,8 @@
$string['autonumbering_help'] = 'Enables or disables automated numbers for each question';
$string['average'] = 'Average';
$string['bold'] = 'Bold';
$string['calendarend'] = 'Feedback {$a} closes';
$string['calendarstart'] = 'Feedback {$a} opens';
$string['calendarend'] = '{$a} closes';
$string['calendarstart'] = '{$a} opens';
$string['cannotaccess'] = 'You can only access this feedback from a course';
$string['cannotsavetempl'] = 'saving templates is not allowed';
$string['captcha'] = 'Captcha';
Expand Down
2 changes: 2 additions & 0 deletions mod/lesson/lang/en/lesson.php
Expand Up @@ -276,6 +276,7 @@
$string['lesson:grade'] = 'Grade lesson essay questions';
$string['lessonclosed'] = 'This lesson closed on {$a}.';
$string['lessoncloses'] = 'Lesson closes';
$string['lessoneventcloses'] = '{$a} closes';
$string['lessoncloseson'] = 'Lesson closes on {$a}';
$string['lesson:edit'] = 'Edit a lesson activity';
$string['lessonformating'] = 'Lesson formatting';
Expand All @@ -289,6 +290,7 @@
$string['lessonnotready2'] = 'This lesson is not ready to be taken.';
$string['lessonopen'] = 'This lesson will be open on {$a}.';
$string['lessonopens'] = 'Lesson opens';
$string['lessoneventopens'] = '{$a} opens';
$string['lessonpagelinkingbroken'] = 'First page not found. Lesson page linking must be broken. Please contact an admin.';
$string['lessonstats'] = 'Lesson statistics';
$string['linkedmedia'] = 'Linked media';
Expand Down
4 changes: 2 additions & 2 deletions mod/lesson/lib.php
Expand Up @@ -211,7 +211,7 @@ function lesson_update_events($lesson, $override = null) {
} else {
unset($event->id);
}
$event->name = $eventname.' ('.get_string('lessonopens', 'lesson').')';
$event->name = get_string('lessoneventopens', 'lesson', $eventname);
// The method calendar_event::create will reuse a db record if the id field is set.
calendar_event::create($event);
}
Expand All @@ -222,7 +222,7 @@ function lesson_update_events($lesson, $override = null) {
unset($event->id);
}
$event->type = CALENDAR_EVENT_TYPE_ACTION;
$event->name = $eventname.' ('.get_string('lessoncloses', 'lesson').')';
$event->name = get_string('lessoneventcloses', 'lesson');
$event->timestart = $deadline;
$event->timesort = $deadline;
$event->eventtype = LESSON_EVENT_TYPE_CLOSE;
Expand Down
2 changes: 2 additions & 0 deletions mod/quiz/lang/en/quiz.php
Expand Up @@ -667,6 +667,7 @@
$string['quizclose'] = 'Close the quiz';
$string['quizclosed'] = 'This quiz closed on {$a}';
$string['quizcloses'] = 'Quiz closes';
$string['quizeventcloses'] = '{$a} closes';
$string['quizcloseson'] = 'This quiz will close at {$a}';
$string['quiz:deleteattempts'] = 'Delete quiz attempts';
$string['quiz:emailconfirmsubmission'] = 'Get a confirmation message when submitting';
Expand All @@ -682,6 +683,7 @@
$string['quiz:manageoverrides'] = 'Manage quiz overrides';
$string['quiznavigation'] = 'Quiz navigation';
$string['quizopen'] = 'Open the quiz';
$string['quizeventopens'] = '{$a} opens';
$string['quizopenclose'] = 'Open and close dates';
$string['quizopenclose_help'] = 'Students can only start their attempt(s) after the open time and they must complete their attempts before the close time.';
$string['quizopenclose_link'] = 'mod/quiz/timing';
Expand Down
4 changes: 2 additions & 2 deletions mod/quiz/lib.php
Expand Up @@ -1308,7 +1308,7 @@ function quiz_update_events($quiz, $override = null) {
} else {
unset($event->id);
}
$event->name = $eventname.' ('.get_string('quizopens', 'quiz').')';
$event->name = get_string('quizeventopens', 'quiz', $eventname);
// The method calendar_event::create will reuse a db record if the id field is set.
calendar_event::create($event);
}
Expand All @@ -1319,7 +1319,7 @@ function quiz_update_events($quiz, $override = null) {
unset($event->id);
}
$event->type = CALENDAR_EVENT_TYPE_ACTION;
$event->name = $eventname.' ('.get_string('quizcloses', 'quiz').')';
$event->name = get_string('quizeventcloses', 'quiz', $eventname);
$event->timestart = $timeclose;
$event->timesort = $timeclose;
$event->eventtype = QUIZ_EVENT_TYPE_CLOSE;
Expand Down
4 changes: 2 additions & 2 deletions mod/scorm/lang/en/scorm.php
Expand Up @@ -72,8 +72,8 @@
$string['browsemode'] = 'Preview mode';
$string['browserepository'] = 'Browse repository';
$string['calculatedweight'] = 'Calculated weight';
$string['calendarend'] = 'The SCORM activity \'{$a}\' closes';
$string['calendarstart'] = 'The SCORM activity \'{$a}\' opens';
$string['calendarend'] = '{$a} closes';
$string['calendarstart'] = '{$a} opens';
$string['cannotaccess'] = 'You cannot call this script in that way';
$string['cannotfindsco'] = 'Could not find SCO';
$string['closebeforeopen'] = 'You have specified a close date before the open date.';
Expand Down
8 changes: 4 additions & 4 deletions mod/workshop/lang/en/workshop.php
Expand Up @@ -57,7 +57,7 @@
$string['assessmentdeleted'] = 'Assessment deallocated';
$string['assessmentend'] = 'Deadline for assessment';
$string['assessmentendbeforestart'] = 'Deadline for assessment can not be specified before the open for assessment date';
$string['assessmentendevent'] = '{$a} (assessment deadline)';
$string['assessmentendevent'] = '{$a} deadline for assessment';
$string['assessmentenddatetime'] = 'Assessment deadline: {$a->daydatetime} ({$a->distanceday})';
$string['assessmentform'] = 'Assessment form';
$string['assessmentofsubmission'] = '<a href="{$a->assessmenturl}">Assessment</a> of <a href="{$a->submissionurl}">{$a->submissiontitle}</a>';
Expand All @@ -66,7 +66,7 @@
$string['assessmentreferenceneeded'] = 'You have to assess this example submission to provide a reference assessment. Click \'Continue\' button to assess the submission.';
$string['assessmentsettings'] = 'Assessment settings';
$string['assessmentstart'] = 'Open for assessment from';
$string['assessmentstartevent'] = '{$a} (opens for assessment)';
$string['assessmentstartevent'] = '{$a} opens for assessment';
$string['assessmentstartdatetime'] = 'Open for assessment from {$a->daydatetime} ({$a->distanceday})';
$string['assessmentweight'] = 'Assessment weight';
$string['assignedassessments'] = 'Assigned submissions to assess';
Expand Down Expand Up @@ -274,7 +274,7 @@
$string['submissiondeleteconfirmassess'] = 'Are you sure you want to delete the following submission? Note this will also delete {$a->count} assessments associated with this submission, which may affect the reviewers\' grades.';
$string['submissionend'] = 'Submissions deadline';
$string['submissionendbeforestart'] = 'Submissions deadline can not be specified before the open for submissions date';
$string['submissionendevent'] = '{$a} (submissions deadline)';
$string['submissionendevent'] = '{$a} deadline for submissions';
$string['submissionenddatetime'] = 'Submissions deadline: {$a->daydatetime} ({$a->distanceday})';
$string['submissionendswitch'] = 'Switch to the next phase after the submissions deadline';
$string['submissionendswitch_help'] = 'If the submissions deadline is specified and this box is checked, the workshop will automatically switch to the assessment phase after the submissions deadline.
Expand All @@ -288,7 +288,7 @@
$string['submissionrequiredfile'] = 'You need to add a file or enter some text.';
$string['submissionsettings'] = 'Submission settings';
$string['submissionstart'] = 'Open for submissions from';
$string['submissionstartevent'] = '{$a} (opens for submissions)';
$string['submissionstartevent'] = '{$a} opens for submissions';
$string['submissionstartdatetime'] = 'Open for submissions from {$a->daydatetime} ({$a->distanceday})';
$string['submissiontitle'] = 'Title';
$string['submissionsreport'] = 'Workshop submissions report';
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2017100600.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2017100800.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit f10721d

Please sign in to comment.