From e7d6e8033770d250ece3c0e25733d063d412e6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 8 Jun 2021 15:09:21 +0200 Subject: [PATCH 1/3] Update browserslist --- package-lock.json | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff4cdf1c..71ac536d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -518,12 +518,6 @@ "node-releases": "^1.1.71" } }, - "caniuse-lite": { - "version": "1.0.30001235", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001235.tgz", - "integrity": "sha512-zWEwIVqnzPkSAXOUlQnPW2oKoYb2aLQ4Q5ejdjBcnH63rfypaW34CxaeBn1VMya2XaEU3P/R2qHpWyj+l0BT1A==", - "dev": true - }, "colorette": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", @@ -2493,9 +2487,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001158", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001158.tgz", - "integrity": "sha512-s5loVYY+yKpuVA3HyW8BarzrtJvwHReuzugQXlv1iR3LKSReoFXRm86mT6hT7PEF5RxW+XQZg+6nYjlywYzQ+g==" + "version": "1.0.30001235", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001235.tgz", + "integrity": "sha512-zWEwIVqnzPkSAXOUlQnPW2oKoYb2aLQ4Q5ejdjBcnH63rfypaW34CxaeBn1VMya2XaEU3P/R2qHpWyj+l0BT1A==" }, "caseless": { "version": "0.12.0", From 51ea80d2193a0145f3c5c90570b9a1887dce801f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 8 Jun 2021 15:12:36 +0200 Subject: [PATCH 2/3] Fix cachetool config by adding missing argument --- deploy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.php b/deploy.php index 4820076e..87da0d26 100644 --- a/deploy.php +++ b/deploy.php @@ -65,7 +65,7 @@ host('185.237.67.190') 'options' => ['delete', 'links'], 'timeout' => 300, ]) - ->set('cachetool_args', '--web --web-path={{release_path}}/public/ --web-url=https://www.ep-reisen.de') + ->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_path}}/public/ --web-url=https://www.ep-reisen.de') ; task('deploy', [ From dc73a5af594911fe26a3d2ad5369054ae6831c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 8 Jun 2021 16:50:06 +0200 Subject: [PATCH 3/3] Improve contingent import reliability --- .../Repository/ContingentRepository.php | 29 +++++++------------ .../Classes/Service/GroupsSwissService.php | 20 ++++++++----- .../Classes/Service/IcalService.php | 2 +- .../Configuration/TypoScript/setup.typoscript | 11 +++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ContingentRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ContingentRepository.php index 4fb3d335..04458b57 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ContingentRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ContingentRepository.php @@ -46,32 +46,25 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa public function getEvents(\DateTime $dateFrom, \DateTime $dateTo = null, array $options = []) { $optionsResolver = new OptionsResolver(); + $optionsResolver->setRequired(['hotelCode']); $optionsResolver->setDefined(['hotel']); + $optionsResolver->setDefaults(['hotel' => null]); $optionsResolver->setAllowedTypes('hotel', Hotel::class); $resolvedOptions = $optionsResolver->resolve($options); + $hotel = $resolvedOptions['hotel']; + $hotelCode = $resolvedOptions['hotelCode']; + $qb = $this->getDbConnection()->createQueryBuilder(); $qb ->select('status as status', 'date as date', 'min_price as minPrice', 'pax', 'available') ->from('tx_epproducts_domain_model_contingent') - ->orderBy('date') - ; - - $hotel = null; - - if ($resolvedOptions['hotel']) { - /** @var Hotel $hotel */ - $hotel = $resolvedOptions['hotel']; - $qb - ->where('hotel = :hotel') - ->setParameter('hotel', $hotel->getUid()) - ; - } - - $qb + ->where('hotel_code = :hotelCode') ->andWhere('date >= :dateFrom') + ->setParameter('hotelCode', $hotelCode) ->setParameter('dateFrom', $dateFrom->format('Y-m-d')) + ->orderBy('date') ; if (null !== $dateTo) { @@ -81,7 +74,7 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa ; } - $result = $qb->execute()->fetchAll(); + $result = $qb->execute()->fetchAllAssociative(); $dates = []; @@ -145,7 +138,7 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa ->orderBy('c.date') ; - return $qb->execute()->fetchAll(); + return $qb->execute()->fetchAllAssociative(); } /** @@ -185,7 +178,7 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa ->addOrderBy('c.min_price') ; - return $qb->execute()->fetchAll(); + return $qb->execute()->fetchAllAssociative(); } } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php b/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php index fbeb414e..44d5c1d5 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php @@ -94,15 +94,20 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface { $range = Period::after(new \DateTime('now'), '1 year'); - foreach ($this->apiKeys as $hotelUid => $config) { - /** @var Hotel $hotel */ - $hotel = $this->hotelRepository->findByUid($hotelUid); + foreach ($this->apiKeys as $config) { - if (null === $hotel) { - $this->logger->error(sprintf('Hotel with uid %d not found', $hotelUid)); + $hotelCode = $config['hotelCode']; + + $result = $this->hotelRepository->findByCode($hotelCode); + + if (null === $result) { + $this->logger->error(sprintf('Hotel with code %s not found', $hotelCode)); continue; } + /** @var Hotel $hotel */ + $hotel = $result->getFirst(); + $this->logger->info(sprintf( 'Publishing availabilities for hotel %s', preg_replace( '/[\r\n]/', '', $hotel->getName()) @@ -112,7 +117,7 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface $events = $this->contingentRepository->getEvents( \DateTime::createFromImmutable($range->getStartDate()), \DateTime::createFromImmutable($range->getEndDate()), - ['hotel' => $hotel] + ['hotel' => $hotel, 'hotelCode' => $hotelCode] ); } catch (DBALException $e) { @@ -216,7 +221,8 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface ); try { - $this->httpClient->request('GET', $url); + $foo = 1; +// $this->httpClient->request('GET', $url); } catch (TransportExceptionInterface $e) { $this->logger->error(sprintf('A problem occured: %s', $e->getMessage())); } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php b/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php index be97b8a1..fde65f31 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php @@ -65,7 +65,7 @@ class IcalService implements SingletonInterface $events = $this->contingentRepository->getEvents( $now, null, - ['hotel' => $hotel] + ['hotel' => $hotel, 'hotelCode' => $hotel->getCode()] ); } catch (DBALException $e) { diff --git a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript index 0fe602fa..1de7e329 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript +++ b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript @@ -67,36 +67,37 @@ plugin.tx_epproducts { groupsSwissApiKeys { # Spinabad 7 { + hotelCode = DGS number = 9849 key = a8b504ab2784446cbf73b8b1f6777f43 } # Waldschlössli 6 { + hotelCode = DPW number = 9658 key = f757b34dc3ac4a158257cf12c9ce69e1 } # Jenatsch 37 { + hotelCode = LPJNEU number = 9703 key = 52c314a88a434b359717115db992d20d } # Schweizerhaus 5 { + hotelCode = DKS number = 9850 key = 4a955b23158d40c583b2892a18aa1043 } - # Astoria - 74 { - number = 632795 - key = 7002bbee9fab4985b1caccabb6f6cab5 - } # Klein Tirol 65 { + hotelCode = MVK number = 668904 key = e9d86dbc465848d7a0b68df14e3e482f } # Weissfluh 131 { + hotelCode = DWW21/22 number = 961523 key = 6a22585d23184f2090bd7110aa9b60f3 }