Skip to content

Commit

Permalink
Fixing calendar's events not being removed when a booking was deleted
Browse files Browse the repository at this point in the history
Fixing busy slots appearing in different dates
  • Loading branch information
Ravenink committed Nov 18, 2019
1 parent 3369020 commit 66040fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions amd/src/date_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,10 @@ define(['jquery','jqueryui'], function($){

$.getJSON(busy_slots_url, function( data ){
dpicker.log( 'GET ' + busy_slots_url);

if (data['busy-slots'].length == 0 ) {
if (data['busy-slots'].length === 0 ) {
tpickr.clear_busy_interv();
dpicker.log('No busy slots this day');
} else if ( tpickr.is_interval_picker_init()) {
} else if (tpickr.is_interval_picker_init()) {
tpickr.set_busy(data['busy-slots']);
tpickr.disable_busy_interv();
tpickr.next_free_interv(scroll);
Expand Down
2 changes: 1 addition & 1 deletion amd/src/time_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ tpicker.prototype.clear_interv = function(){
};

tpicker.prototype.clear_busy_interv = function(){
this.busy_slots = null;
this.icells().removeClass('interv-busy');
this.icells().not('.interv-past').removeClass('disabled').on('click', { tpicker: this }, this.on_interv_click );
};
Expand Down Expand Up @@ -355,7 +356,6 @@ tpicker.prototype.disable_busy_interv = function( ){
if ( time_picker.busy_slots.includes(time) ) { // busy, disable
time_picker.log('Disabling ' + time);
time_picker.set_busy_interv($(this));

}
/*
else {
Expand Down
3 changes: 2 additions & 1 deletion ejsappbooking_model.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ public function delete_booking($bookid) { // Check and delete booking
$name = get_string('book_message', 'ejsappbooking') . ' ' . $lab->name .
'. ' . $prac->practiceintro;
$inittime = DateTime::createFromFormat('Y-m-d H:i:s', $record->starttime, $this->get_user_timezone());
//$inittime = DateTime::createFromFormat('Y-m-d H:i:s', "2019-11-18 22:15:00", $this->get_user_timezone());
$time = make_timestamp($inittime->format('Y'), $inittime->format('m'),
$inittime->format('d'), $inittime->format('H'));
$inittime->format('d'), $inittime->format('H'), $inittime->format('i'));
$event = $DB->get_record_sql('SELECT * FROM {event} WHERE userid = ? AND name = ? AND timestart = ?',
array($USER->id, $name, $time));
// Delete calendar´s event.
Expand Down

0 comments on commit 66040fa

Please sign in to comment.