Skip to content

Commit

Permalink
MBS-8974: Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-csg committed Jan 13, 2025
1 parent 8ab5405 commit 2746e5d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions classes/boardmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ public function unassign_user(int $cardid, int $userid): void {
public function set_card_complete(int $cardid, int $state): void {
global $DB, $USER;
$card = $this->get_card($cardid);
$update = ['id' => $cardid, 'completed' => $state, 'timemodified' => time()];
$update = ['id' => $cardid, 'completed' => $state, 'timemodified' => time(), 'repeat_enable' => 0];
$this->formatter->put('cards', $update);
$DB->update_record('kanban_card', $update);
$assignees = $this->get_card_assignees($cardid);
Expand All @@ -706,9 +706,6 @@ public function set_card_complete(int $cardid, int $state): void {
);
$newcard->reminder = $newcard->duedate - $timedifference;
}
$card->repeat_enable = 0;
$this->update_card($cardid, (array) $card);
$newcard->isrepeated = 1;
$this->add_card($this->get_leftmost_column($card->kanban_board), 0, (array)$newcard);
}
} else {
Expand Down
3 changes: 2 additions & 1 deletion classes/form/edit_card_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ public function definition() {

$mform->setType('repeat_interval', PARAM_INT);
$mform->setType('repeat_interval_type', PARAM_INT);
$mform->setDefault('repeat_enable', 0);
$mform->setDefault('repeat_interval', 1);
$mform->disabledIf('repeatgroup', 'repeat_enable', 'notchecked');
$mform->disabledIf('repeatgroup', 'repeat_enable');
$mform->disabledIf('repeat_interval', 'repeat_newduedate', 'eq', constants::MOD_KANBAN_REPEAT_NONEWDUEDATE);
$mform->disabledIf('repeat_interval_type', 'repeat_newduedate', 'eq', constants::MOD_KANBAN_REPEAT_NONEWDUEDATE);
$mform->addHelpButton('repeatgroup', 'repeat', 'kanban');
Expand Down
2 changes: 1 addition & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="repeat_enable" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="repeat_interval" TYPE="int" LENGTH="11" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="repeat_interval" TYPE="int" LENGTH="11" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="repeat_interval_type" TYPE="int" LENGTH="11" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="repeat_newduedate" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
Expand Down
2 changes: 1 addition & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function xmldb_kanban_upgrade($oldversion) {
$dbman->add_field($table, $field);
}

$field = new xmldb_field('repeat_interval', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '0', 'repeat_enable');
$field = new xmldb_field('repeat_interval', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '1', 'repeat_enable');

// Conditionally launch add field repeat_interval.
if (!$dbman->field_exists($table, $field)) {
Expand Down

0 comments on commit 2746e5d

Please sign in to comment.