Skip to content

Commit

Permalink
Implemented PR Feedback related to DB
Browse files Browse the repository at this point in the history
Implemented PR Feedback related to DB
  • Loading branch information
paulandm committed Nov 12, 2024
1 parent 4713350 commit 8a098fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 9 additions & 4 deletions classes/task/send_ical_notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@ private function get_zoom_events_to_notify() {
FROM {event}
WHERE modulename = :zoommodulename
AND eventtype = :zoomeventtype
AND timemodified >= (unix_timestamp() - (60 * 60))
AND timemodified <= (unix_timestamp() - (10 * 60))';

return $DB->get_records_sql($sql, ['zoommodulename' => 'zoom', 'zoomeventtype' => 'zoom']);
AND timemodified >= :onehourago
AND timemodified <= :tenminutesago';

return $DB->get_records_sql($sql, [
'zoommodulename' => 'zoom',
'zoomeventtype' => 'zoom',
'onehourago' => time() - (60 * 60),
'tenminutesago' => time() - (60 * 10),
]);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@
</FIELDS>
<KEYS>
<KEY NAME="id_primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="fk_zoomeventid" TYPE="foreign" FIELDS="zoomeventid" REFTABLE="event" REFFIELDS="id"/>
<KEY NAME="zoomeventid" TYPE="unique" FIELDS="zoomeventid"/>
<KEY NAME="fk_zoomeventid" TYPE="foreign-unique" FIELDS="zoomeventid" REFTABLE="event" REFFIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
Expand Down
3 changes: 1 addition & 2 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,7 @@ function xmldb_zoom_upgrade($oldversion) {
$table->add_field('executiontime', XMLDB_TYPE_INTEGER, '12', null, null, null, null);

$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
$table->add_key('fk_zoomeventid', XMLDB_KEY_FOREIGN, ['zoomeventid'], 'event', ['id']);
$table->add_key('unique_zoomeventid', XMLDB_KEY_UNIQUE, ['zoomeventid']);
$table->add_key('fk_zoomeventid', XMLDB_KEY_FOREIGN_UNIQUE, ['zoomeventid'], 'event', ['id']);

$dbman->create_table($table);
}
Expand Down

0 comments on commit 8a098fd

Please sign in to comment.