Skip to content

Commit

Permalink
Merge pull request #49 from KQMATH/release/0.4.2
Browse files Browse the repository at this point in the history
Release/0.4.2
  • Loading branch information
hgeorgsch authored Feb 3, 2021
2 parents d6d47ec + 8226519 commit 457dc9b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 30 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Wiki sync

on: [gollum]

jobs:
copycat:
name: Copycat
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Copycat KQMATH
uses: andstor/copycat-action@v1.1.0
env:
DST_BRANCH: master
DST_OWNER: KQMATH
DST_REPO_NAME: kqmath.github.io
DST_PATH: /docs/shortmath/
GH_PAT: ${{ secrets.GH_PAT }}
SRC_BRANCH: master
SRC_PATH: /.
SRC_WIKI: "true"
USERNAME: nutsbot
EMAIL: andr3.storhaug+bot@gmail.com
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.idea/
out/
docs/
node_modules/
node_modules/
vendor/
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Changed
-

## [0.4.2] - 2021-02-03
### Fixed
- Fixed bug #33 regarding backup and restore problems.

## [0.4.1] - 2019-05-29
### Fixed
- Fixed bug #26 regarding multiple ShortMath questions in one quiz page.
Expand All @@ -32,7 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Added
-

[Unreleased]: https://github.com/KQMATH/moodle-qtype_shortmath/compare/v0.4.1...HEAD
[Unreleased]: https://github.com/KQMATH/moodle-qtype_shortmath/compare/v0.4.2...HEAD
[0.4.2]: https://github.com/KQMATH/moodle-qtype_shortmath/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/KQMATH/moodle-qtype_shortmath/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/KQMATH/moodle-qtype_shortmath/compare/v0.3.1...v0.4.0
[0.3.1]: https://github.com/KQMATH/moodle-qtype_shortmath/compare/v0.3.0...v0.3.1
Expand Down
8 changes: 3 additions & 5 deletions backup/moodle2/backup_qtype_shortmath_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class backup_qtype_shortmath_plugin extends backup_qtype_plugin {
*/
protected function define_question_plugin_structure() {
// Define the virtual plugin element with the condition to fulfill.
$plugin = $this->get_plugin_element(null, '../../qtype', 'shortmath');
$plugin = $this->get_plugin_element(null, '../../qtype', $this->pluginname);
// Create one standard named plugin element (the visible container).
$pluginwrapper = new backup_nested_element($this->get_recommended_name());
// Connect the visible container ASAP.
Expand All @@ -48,13 +48,11 @@ protected function define_question_plugin_structure() {
// to the tree before any other information that will use them.
$this->add_question_question_answers($pluginwrapper);
// Now create the qtype own structures.
$shortmath = new backup_nested_element('shortmath', ['id'], ['answers', 'usecase', 'usehint']);
$shortmath = new backup_nested_element('shortmath', ['id'], ['questionid', 'usecase']);
// Now the own qtype tree.
$pluginwrapper->add_child($shortmath);
// Set source to populate the data.
// JR changed table name to match new table name system in moodle 2.1 DEC 2011.
// JR changed field name question to questionid JAN 2012.
$shortmath->set_source_table('qtype_shortmath', ['questionid' => backup::VAR_PARENTID]);
$shortmath->set_source_table('qtype_shortmath_options', ['questionid' => backup::VAR_PARENTID]);
// Don't need to annotate ids nor files.
return $plugin;
}
Expand Down
14 changes: 2 additions & 12 deletions backup/moodle2/restore_qtype_shortmath_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,10 @@ public function process_shortmath($data) {
if ($questioncreated) {
// Adjust some columns.
$data->questionid = $newquestionid;
// Map sequence of question_answer ids.
$answersarr = explode(',', $data->answers);
foreach ($answersarr as $key => $answer) {
// Postgresql does not handle empty strings as integer values.
if ($answer == '') {
$answer = null;
}
$answersarr[$key] = $this->get_mappingid('question_answer', $answer);
}
$data->answers = implode(',', $answersarr);
// Insert record.
$newitemid = $DB->insert_record('qtype_shortmath', $data);
$newitemid = $DB->insert_record('qtype_shortmath_options', $data);
// Create mapping.
$this->set_mapping('qtype_shortmath', $oldid, $newitemid);
$this->set_mapping('qtype_shortmath_options', $oldid, $newitemid);
}
}
}
21 changes: 12 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

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

$plugin->version = 2019052900;
$plugin->version = 2021020300;
$plugin->requires = 2018051700; // Moodle version 3.5.
$plugin->component = 'qtype_shortmath';
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '0.4.1';
$plugin->release = '0.4.2';

0 comments on commit 457dc9b

Please sign in to comment.