feat: manually maintained webcams are shown regardless of availability
The feed's "verfügbar" flag only applies to imported webcams. Editors who tick "Manuell gepflegt" expect the webcam to appear, so the website, the API and the content feed now show a webcam if it is available or manual; manual ones are hidden via "Verbergen" instead. The availability checkbox is hidden on manual webcams, which reloads the form when toggled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
4598fb8aa5
commit
a7b7b7a476
6 files changed
+34
-6
No files matched your search
@@ -388,7 +388,10 @@ class RecordSerializer
|
||||
->select('url')
|
||||
->from('tx_epproducts_domain_model_webcam')->where(
|
||||
$queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($webcamUid, Connection::PARAM_INT)),
|
||||
$queryBuilder->expr()->eq('available', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT)),
|
||||
$queryBuilder->expr()->or(
|
||||
$queryBuilder->expr()->eq('available', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT)),
|
||||
$queryBuilder->expr()->eq('manual', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT)),
|
||||
),
|
||||
)->executeQuery()
|
||||
->fetchOne()
|
||||
;
|
||||
|
||||
@@ -371,7 +371,7 @@ class Region extends AbstractDestination implements TeaserInterface
|
||||
public function getWebcamAvailable(): bool
|
||||
{
|
||||
$webcam = $this->getWebcam();
|
||||
return $webcam !== null && $webcam->getAvailable();
|
||||
return null !== $webcam && $webcam->isVisible();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,11 @@ class Webcam extends AbstractEntity
|
||||
*/
|
||||
protected $available = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $manual = false;
|
||||
|
||||
/**
|
||||
* @return Snowreport
|
||||
*/
|
||||
@@ -113,4 +118,22 @@ class Webcam extends AbstractEntity
|
||||
{
|
||||
$this->available = $available;
|
||||
}
|
||||
|
||||
public function getManual(): bool
|
||||
{
|
||||
return (bool) $this->manual;
|
||||
}
|
||||
|
||||
public function setManual(bool $manual): void
|
||||
{
|
||||
$this->manual = $manual;
|
||||
}
|
||||
|
||||
/**
|
||||
* The feed's availability only applies to imported cams; editors show or hide their own via "hidden"
|
||||
*/
|
||||
public function isVisible(): bool
|
||||
{
|
||||
return $this->getManual() || (bool) $this->getAvailable();
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ class ApiMiddleware implements MiddlewareInterface
|
||||
'webcam.url as webcamUrl',
|
||||
)
|
||||
->from('tx_epproducts_domain_model_region', 'region')
|
||||
->leftJoin('region', 'tx_epproducts_domain_model_webcam', 'webcam', 'region.webcam = webcam.uid AND webcam.available = 1')
|
||||
->leftJoin('region', 'tx_epproducts_domain_model_webcam', 'webcam', 'region.webcam = webcam.uid AND (webcam.available = 1 OR webcam.manual = 1)')
|
||||
->where($queryBuilder->expr()->eq('region.uid', $queryBuilder->createNamedParameter($regionUid, Connection::PARAM_INT)))->setMaxResults(1)->executeQuery()
|
||||
->fetchAssociative()
|
||||
;
|
||||
|
||||
@@ -138,15 +138,17 @@ return [
|
||||
'available' => [
|
||||
'exclude' => 0,
|
||||
'label' => 'verfügbar',
|
||||
'description' => 'Vom Import gesetzt, gilt nur für importierte Webcams',
|
||||
'displayCond' => 'FIELD:manual:REQ:false',
|
||||
'config' => [
|
||||
'type' => 'check',
|
||||
'default' => 1,
|
||||
],
|
||||
],
|
||||
'manual' => [
|
||||
'exclude' => 0,
|
||||
'label' => 'Manuell gepflegt',
|
||||
'description' => 'Der Schneehöhen-Import ändert und löscht diese Webcam nicht',
|
||||
'description' => 'Der Schneehöhen-Import ändert und löscht diese Webcam nicht; sie wird immer angezeigt (ausblenden über "Verbergen")',
|
||||
'onChange' => 'reload',
|
||||
'config' => [
|
||||
'type' => 'check',
|
||||
'default' => 1,
|
||||
|
||||
Reference in new issue
Block a user