Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
d1ff1cult0 committed Nov 28, 2024
1 parent 1fefd5a commit 64829c7
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function scheduleAction()
foreach ($formData as $formKey => $formValue) {
$split = explode('_', $formKey);
if ($split[0] == 'interval' && $formValue) {
$openingTime = $split[1]; // 'noon' of 'evening'
$openingTime = $split[1]; // 'noon' or 'evening'
if ($openingTime == 'noon') {
$startHour = '12:35';
$endHour = '13:55';
Expand All @@ -160,10 +160,10 @@ public function scheduleAction()
$shiftStartDate = $split[2] . ' ' . $shiftStartHour;
$shiftEndDate = $split[2] . ' ' . $shiftEndHour;

$reward = $openingTime == 'noon' ? 2 : 1; // 1 of 2 shiftersbonnen adhv middag- of avondshift
$reward = $openingTime == 'noon' ? 2 : 1;
$signoutDate = DateTime::createFromFormat('d/m/Y', $split[2])->modify('+1 day')->format('d/m/Y') . ' 00:00';

$data = array( //opening uren en registratie shiften
$data = array(
// OPENING HOURS
'start_date' => $startDate,
'end_date' => $endDate,
Expand All @@ -183,7 +183,7 @@ public function scheduleAction()
'event' => '',
'location' => 1,
'handled_on_event' => false,
'ticket_needed' => false,
'ticket_needed' => true,
'points' => 0,
);

Expand All @@ -204,17 +204,17 @@ public function scheduleAction()
'nb_volunteers_min' => $formData['volunteers-min_' . $openingTime . '_' . $split[2]],
'reward' => $reward,
'handled_on_event' => false,
'ticket_needed' => true,
'ticket_needed' => false,
'points' => 0,
);

// OPENING HOURS
$this->getEntityManager()->persist(
$form->getHydrator()->hydrate($data) //send opening hours data to database
$form->getHydrator()->hydrate($data)
);
// SHIFTS
$this->getEntityManager()->persist(
$shiftForm->getHydrator()->hydrate($shiftData) //send Shift DATA to database
$shiftForm->getHydrator()->hydrate($shiftData)
);

// REGISTRATION SHIFTS
Expand All @@ -226,7 +226,7 @@ public function scheduleAction()
$data['end_date'] = $split[2] . ' ' . $nextTime;

$this->getEntityManager()->persist(
$registrationForm->getHydrator()->hydrate($data) // send registration shift data to database
$registrationForm->getHydrator()->hydrate($data)
);

$startHour_ = $nextTime;
Expand Down Expand Up @@ -309,7 +309,7 @@ private function getOpeningHourEntity()
/**
* @return string
*/
private function calculateNextTime($time, $endTime) //TODO generalize this function to work in all cases
private function calculateNextTime($time, $endTime)
{
$hour = explode(':', $time)[0];
$minute = explode(':', $time)[1];
Expand All @@ -322,7 +322,6 @@ private function calculateNextTime($time, $endTime) //TODO generalize this funct
$minute = '00';
}

// als $hour : $minute groter is dan $endTime dan return $endTime
if ($hour > $endHour or ($hour == $endHour and $minute >= $endMinute)) {
return $endTime;
} else {
Expand Down

0 comments on commit 64829c7

Please sign in to comment.