Skip to content
Snippets Groups Projects
Commit 45cd4aad authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

add block length to lock time, fixes #2398

Closes #2398

Merge request studip/studip!1589
parent 14685322
No related branches found
No related tags found
No related merge requests found
...@@ -43,12 +43,14 @@ trait ConsultationHelper ...@@ -43,12 +43,14 @@ trait ConsultationHelper
protected function createBlockWithSlotsForRange(Range $range, bool $lock_blocks = false): ConsultationBlock protected function createBlockWithSlotsForRange(Range $range, bool $lock_blocks = false): ConsultationBlock
{ {
$slot_length_in_hours = 2;
// Generate start and end time. Assures that the day is not a holiday. // Generate start and end time. Assures that the day is not a holiday.
$now = time(); $now = time();
do { do {
$begin = strtotime('next monday 8:00:00', $now); $begin = strtotime('next monday 8:00:00', $now);
$end = strtotime('+2 hours', $begin); $end = strtotime("+{$slot_length_in_hours} hours", $begin);
$now = strtotime('+1 week', $now); $now = strtotime('+1 week', $now);
...@@ -58,7 +60,7 @@ trait ConsultationHelper ...@@ -58,7 +60,7 @@ trait ConsultationHelper
// Lock blocks? // Lock blocks?
$additional_data = []; $additional_data = [];
if ($lock_blocks) { if ($lock_blocks) {
$additional_data['lock_time'] = ceil(($begin - time()) / 3600); $additional_data['lock_time'] = ceil(($begin - time()) / 3600) + $slot_length_in_hours;
} }
// Generate blocks // Generate blocks
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment