Skip to content

Commit

Permalink
fix(ZMSKVR-134): filter out non bookable days in getFreeDays (#889)
Browse files Browse the repository at this point in the history
* fix(ZMSKVR-134): filter out non bookable days in getFreeDays

* clean(ZMSKVR-134): imports

* clean(ZMSKVR-134): imports

---------

Co-authored-by: Thomas Fink <tom@Thomass-MacBook-Air.local>
  • Loading branch information
ThomasAFink and Thomas Fink authored Feb 21, 2025
1 parent 7b4c489 commit da896f7
Show file tree
Hide file tree
Showing 9 changed files with 451 additions and 133 deletions.
169 changes: 154 additions & 15 deletions zmsadmin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion zmsadmin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"react-to-print": "^2.14.10",
"redux-json-schema": "^1.0.0",
"stream-http": "^3.2.0",
"svgo": "^3.3.2",
"url": "^0.11.0",
"util": "^0.12.5"
},
Expand All @@ -66,4 +67,4 @@
"chart.js": "^4.4.2",
"react-chartjs-2": "^5.2.0"
}
}
}
3 changes: 2 additions & 1 deletion zmscalldisplay/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions zmscalldisplay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"parcel": "^2.6.2",
"postcss": "^8.4.16",
"qrcode-generator": "1.4.4",
"sass": "^1.54.4"
"sass": "^1.54.4",
"svgo": "^3.3.2"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use BO\Zmsentities\Calendar;
use BO\Zmsentities\Process;
use BO\Zmsentities\Source;
use BO\Zmsentities\Collection\DayList;
use BO\Zmsentities\Collection\ProcessList;
use BO\Zmsentities\Collection\ProviderList;
use BO\Zmsentities\Collection\RequestList;
Expand Down Expand Up @@ -111,9 +112,18 @@ public static function getFreeDays(ProviderList $providers, RequestList $request
$calendar->requests = $requests;
$result = \App::$http->readPostResult('/calendar/', $calendar);
$entity = $result?->getEntity();

if (!$entity instanceof Calendar) {
return new Calendar();
}
$bookableDays = new DayList();
foreach ($entity->days as $day) {
if (isset($day['status']) && $day['status'] === 'bookable') {
$bookableDays->addEntity($day);
}
}
$entity->days = $bookableDays;

return $entity;
} catch (\Exception $e) {
ExceptionService::handleException($e);
Expand Down
Loading

0 comments on commit da896f7

Please sign in to comment.