Skip to content

Commit

Permalink
MBS-8971: Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-csg committed Mar 25, 2024
1 parent 32c0a69 commit 614bd62
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
9 changes: 4 additions & 5 deletions classes/migrationhelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
namespace mod_learningmap;

/**
* This class provides helper functions for migration from older learningmaps being stored in the intro field
* to the new column 'svgcode'.
* This class provides helper functions for migration from learningmaps being stored in the intro field to the new column svgcode.
*
* @package mod_learningmap
* @copyright 2024 ISB Bayern
Expand Down Expand Up @@ -73,9 +72,9 @@ public static function move_files_to_background_filearea(int $instanceid) {
* Checks if the given learningmap instance has a SVG code stored in the 'svgcode' column.
*
* @param int $instanceid The id of the learningmap instance.
* @return boolean
* @return bool
*/
public static function is_version_without_svgcode(int $instanceid) {
public static function is_version_without_svgcode(int $instanceid): bool {
global $DB;
$entry = $DB->get_record('learningmap', ['id' => $instanceid]);
return empty($entry->svgcode);
Expand All @@ -84,7 +83,7 @@ public static function is_version_without_svgcode(int $instanceid) {
/**
* Update one learningmap instance to have the SVG code stored in the 'svgcode' column.
*
* @param integer $instanceid The id of the learningmap instance. If empty, all learningmaps will be updated.
* @param int $instanceid The id of the learningmap instance. If empty, all learningmaps will be updated.
* @return void
*/
public static function update_learningmaps_to_use_svgcode(int $instanceid = 0) {
Expand Down
8 changes: 5 additions & 3 deletions tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* mod_learningmap data generator
*
* @package mod_learningmap
* @copyright 2021-2024, ISB Bayern
* @copyright 2021-2024, ISB Bayern
* @author Stefan Hanauska <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -36,8 +36,10 @@ public function create_instance($record = null, array $options = null): stdClass

$record = (array)$record + [
'name' => 'test map',
'intro' => file_get_contents($CFG->dirroot . '/mod/learningmap/tests/generator/test.svg'),
'introformat' => 1,
'intro' => 'test intro',
'introformat' => 0,
'svgcode' => file_get_contents($CFG->dirroot . '/mod/learningmap/tests/generator/test.svg'),
'showmaponcoursepage' => 1,
'placestore' => file_get_contents($CFG->dirroot . '/mod/learningmap/tests/generator/test.json'),
'completiontype' => 2,
];
Expand Down
2 changes: 1 addition & 1 deletion tests/mod_learningmap_activitymanager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Unit test for mod_learningmap
*
* @package mod_learningmap
* @copyright 2021-2024, ISB Bayern
* @copyright 2021-2024, ISB Bayern
* @author Stefan Hanauska <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @group mod_learningmap
Expand Down
2 changes: 1 addition & 1 deletion tests/mod_learningmap_generation_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Unit test for mod_learningmap
*
* @package mod_learningmap
* @copyright 2021-2024, ISB Bayern
* @copyright 2021-2024, ISB Bayern
* @author Stefan Hanauska <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @group mod_learningmap
Expand Down

0 comments on commit 614bd62

Please sign in to comment.