Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

III-5808 sapi inconsistency last day open #254

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: up down bash install ci stan cs cs-fix test migrate migrate-force
.PHONY: up down bash install ci stan cs cs-fix test migrate migrate-force test-filter

up:
docker-compose up -d
Expand Down Expand Up @@ -27,6 +27,9 @@ cs-fix:
test:
docker exec -it search.uitdatabank composer test

test-filter:
docker exec -it search.uitdatabank composer test -- --filter=$(filter)

migrate:
docker exec -it search.uitdatabank ./bin/app.php elasticsearch:migrate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,14 @@ private function polyFillJsonLdSubEventsFromOpeningHours(array $from): array
} else {
$startDate = Chronos::createFromFormat(DateTime::ATOM, $from['startDate']);
$endDate = Chronos::createFromFormat(DateTime::ATOM, $from['endDate']);
// Remove this next line of code, if we ever switch to PHP 8.2
// See below for alternative fix on PHP 8.2
$endDate = $endDate->add(new DateInterval('P1D'));
}

$interval = new DateInterval('P1D');
// If we ever switch to PHP replace this with
// $period = new DatePeriod($startDate, $interval, $endDate, DatePeriod::INCLUDE_END_DATE);
$period = new DatePeriod($startDate, $interval, $endDate);

$subEvent = [];
Expand Down
11 changes: 11 additions & 0 deletions tests/ElasticSearch/JsonDocument/EventTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ public function it_transforms_periodic_opening_hours_to_date_ranges(): void
);
}

/**
* @test
*/
public function it_transforms_periodic_last_opening_hours_last_day_open_to_date_ranges(): void
{
$this->transformAndAssert(
__DIR__ . '/data/event/original-periodic-with-opening-hours-last-day-open.json',
__DIR__ . '/data/event/indexed-periodic-with-opening-hours-last-day-open.json'
);
}

/**
* @test
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"@id":"http:\/\/udb-silex.dev\/event\/23017cb7-e515-47b4-87c4-780735acc942",
"@type":"Event",
"id":"23017cb7-e515-47b4-87c4-780735acc942",
"mainLanguage":"nl",
"languages":[
"nl"
],
"completedLanguages":[
"nl"
],
"name":{
"nl":"Punkfest"
},
"status":"Available",
"bookingAvailability":"Available",
"calendarType":"periodic",
"dateRange":[
{
"gte":"2023-10-30T09:00:00+01:00",
"lte":"2023-10-30T17:00:00+01:00"
},
{
"gte":"2023-10-31T09:00:00+01:00",
"lte":"2023-10-31T17:00:00+01:00"
},
{
"gte":"2023-11-01T09:00:00+01:00",
"lte":"2023-11-01T17:00:00+01:00"
},
{
"gte":"2023-11-02T09:00:00+01:00",
"lte":"2023-11-02T17:00:00+01:00"
},
{
"gte":"2023-11-03T09:00:00+01:00",
"lte":"2023-11-03T17:00:00+01:00"
}
],
"localTimeRange":[
{
"gte":"0900",
"lte":"1700"
}
],
"subEvent":[
{
"dateRange":{
"gte":"2023-10-30T09:00:00+01:00",
"lte":"2023-10-30T17:00:00+01:00"
},
"localTimeRange":{
"gte":"0900",
"lte":"1700"
},
"status":"Available",
"bookingAvailability":"Available"
},
{
"dateRange":{
"gte":"2023-10-31T09:00:00+01:00",
"lte":"2023-10-31T17:00:00+01:00"
},
"localTimeRange":{
"gte":"0900",
"lte":"1700"
},
"status":"Available",
"bookingAvailability":"Available"
},
{
"dateRange":{
"gte":"2023-11-01T09:00:00+01:00",
"lte":"2023-11-01T17:00:00+01:00"
},
"localTimeRange":{
"gte":"0900",
"lte":"1700"
},
"status":"Available",
"bookingAvailability":"Available"
},
{
"dateRange":{
"gte":"2023-11-02T09:00:00+01:00",
"lte":"2023-11-02T17:00:00+01:00"
},
"localTimeRange":{
"gte":"0900",
"lte":"1700"
},
"status":"Available",
"bookingAvailability":"Available"
},
{
"dateRange":{
"gte":"2023-11-03T09:00:00+01:00",
"lte":"2023-11-03T17:00:00+01:00"
},
"localTimeRange":{
"gte":"0900",
"lte":"1700"
},
"status":"Available",
"bookingAvailability":"Available"
}
],
"availableTo":"2023-11-03T23:00:00+00:00",
"audienceType":"everyone",
"mediaObjectsCount":0,
"videosCount":0,
"creator":"Jane Doe",
"created":"2017-04-22T13:33:37+02:00",
"workflowStatus":"DRAFT",
"isDuplicate":false,
"productionCollapseValue":"single-offer-23017cb7-e515-47b4-87c4-780735acc942",
"originalEncodedJsonLd":"{\"@id\":\"http:\/\/udb-silex.dev\/event\/23017cb7-e515-47b4-87c4-780735acc942\",\"mainLanguage\":\"nl\",\"languages\":[\"nl\"],\"completedLanguages\":[\"nl\"],\"name\":{\"nl\":\"Punkfest\"},\"calendarType\":\"periodic\",\"startDate\":\"2023-10-29T23:00:00+00:00\",\"endDate\":\"2023-11-03T23:00:00+00:00\",\"status\":{\"type\":\"Available\"},\"bookingAvailability\":{\"type\":\"Available\"},\"openingHours\":[{\"opens\":\"09:00\",\"closes\":\"17:00\",\"dayOfWeek\":[\"monday\",\"tuesday\",\"wednesday\",\"thursday\",\"friday\",\"saturday\"]}],\"availableTo\":\"2023-11-03T23:00:00+00:00\",\"location\":{\"@id\":\"http:\/\/udb-silex.dev\/place\/179c89c5-dba4-417b-ae96-62e7a12c2405\",\"name\":{\"nl\":\"Hungaria\"},\"address\":{\"nl\":{\"addressCountry\":\"BE\",\"addressLocality\":\"Leuven\",\"postalCode\":\"3000\",\"streetAddress\":\"Vaartkom 35\"}}},\"workflowStatus\":\"DRAFT\",\"created\":\"2017-04-22T13:33:37+02:00\",\"creator\":\"Jane Doe\"}",
"attendanceMode":"offline",
"location":{
"@id":"http:\/\/udb-silex.dev\/place\/179c89c5-dba4-417b-ae96-62e7a12c2405",
"@type":"Place",
"id":"179c89c5-dba4-417b-ae96-62e7a12c2405",
"mainId":"179c89c5-dba4-417b-ae96-62e7a12c2405",
"name":{
"nl":"Hungaria"
}
},
"address":{
"nl":{
"addressCountry":"BE",
"addressLocality":"Leuven",
"postalCode":"3000",
"streetAddress":"Vaartkom 35"
}
},
"metadata":{
"popularity":0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"@id": "http:\/\/udb-silex.dev\/event\/23017cb7-e515-47b4-87c4-780735acc942",
"mainLanguage": "nl",
"languages": [
"nl"
],
"completedLanguages": [
"nl"
],
"name": {
"nl": "Punkfest"
},
"calendarType": "periodic",
"startDate": "2023-10-29T23:00:00+00:00",
"endDate": "2023-11-03T23:00:00+00:00",
"status": {
"type": "Available"
},
"bookingAvailability": {
"type": "Available"
},
"openingHours": [
{
"opens": "09:00",
"closes": "17:00",
"dayOfWeek": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday"
]
}
],
"availableTo": "2023-11-03T23:00:00+00:00",
"location": {
"@id": "http:\/\/udb-silex.dev\/place\/179c89c5-dba4-417b-ae96-62e7a12c2405",
"name": {
"nl": "Hungaria"
},
"address": {
"nl": {
"addressCountry": "BE",
"addressLocality": "Leuven",
"postalCode": "3000",
"streetAddress": "Vaartkom 35"
}
}
},
"workflowStatus": "DRAFT",
"created": "2017-04-22T13:33:37+02:00",
"creator": "Jane Doe"
}