fix bookableStock

This commit is contained in:
isUnknown 2024-09-02 14:02:13 +02:00
parent ea052d22f0
commit 9b4e35f3af
8 changed files with 79 additions and 28 deletions

View file

@ -102,7 +102,7 @@ function createMapadoEventRequest($page) {
"subfields" => [
["name" => "startDate"],
["name" => "endDate"],
["name" => "bookableStock"]
["name" => "notInStockContingentBookableStock"]
]
],
]
@ -150,7 +150,7 @@ function saveMapadoEvent($mapadoEvent, $page) {
"date" => substr($session->startDate, 0, 10),
"time" => str_replace(':', 'h', $startTime),
"ticketingUrl" => $ticketingUrl,
"bookableStock" => $session->bookableStock
"bookableStock" => $session->notInStockContingentBookableStock
];
}
@ -164,4 +164,14 @@ function saveMapadoEvent($mapadoEvent, $page) {
$page->update($dataToSave);
return $dataToSave;
}
}
function getEndTime($session) {
$formattedTime = strlen($session['time']) < 4 ? $session['time'] . '00' : $session['time'];
$time1 = DateTime::createFromFormat('G\hi', $formattedTime);
$formattedDuration = strlen($session['duration']) < 4 ? $session['duration'] . '00' : $session['duration'];
$time2 = DateTime::createFromFormat('G\hi', $formattedDuration);
$time1->add(new DateInterval('PT' . $time2->format('H') . 'H' . $time2->format('i') . 'M'));
$endTime = $time1->format('G\hi');
return $endTime;
}