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

Feature zmskvr 145 wartezeit statistik #923

Merged
merged 32 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bd000b5
feat(ZMS-3519) Process Schema um wasMissed erweitern
MoDaae Feb 3, 2025
f6c4e48
feat(ZMS-3519) Process-Entity um wasMissed erweitert, setArrivalTime …
MoDaae Feb 3, 2025
b39b9b8
feat(ZMS-3519) Process-Query Mapping für wasMissed, addValuesWasMisse…
MoDaae Feb 3, 2025
d1124ad
feat(ZMS-3519) WorkstationProcessDelete.php
MoDaae Feb 3, 2025
c170da3
feat(ZMS-3519) migration fuer die Tabelle buerger (wasMissed) hinzuge…
MoDaae Feb 3, 2025
185096d
feat(ZMS-3519) ProcessQueueReset.php aufnahmezeit anpassen
MoDaae Feb 3, 2025
49685b1
feat(ZMS-3519) ProcessQueued Parameter aus dem Request übernehmen
MoDaae Feb 3, 2025
bd5a964
feat(ZMS-3519) getArrivalTime() schaut erst nach der Aufnahmezeit, se…
MoDaae Feb 4, 2025
45f93b9
feat(ZMS-3519) Unit-test fixing
MoDaae Feb 4, 2025
6f00812
Merge remote-tracking branch 'origin/next' into feature-zms-3159-wart…
MoDaae Feb 4, 2025
028e6e2
feat(ZMSKVR-145) migration für calculateDailyWaitingStatistic
MoDaae Mar 4, 2025
2307c6b
feat(ZMSKVR-145) cronjob skript
MoDaae Mar 4, 2025
f6e3ba6
feat(ZMSKVR-145) cronjob Helper-Klasse Berechnung der Wartezeiten pro…
MoDaae Mar 4, 2025
53dac61
feat(ZMSKVR-145) composer.json und composer.lock Anpassung
MoDaae Mar 4, 2025
a6b7698
feat(ZMSKVR-145) skript zum cronjob.daily hinzufügen
MoDaae Mar 4, 2025
6a32f1e
feat(ZMSKVR-145) withSumByHour zum Exchange.php hinzugefügt um die Su…
MoDaae Mar 4, 2025
16ee6ab
feat(ZMSKVR-145) Process.php beim erstellen eines Termin wird nicht d…
MoDaae Mar 4, 2025
e2cd61c
feat(ZMSKVR-145) ProcessFinished.php beim beenden eines Termin wird n…
MoDaae Mar 4, 2025
4ea5473
feat(ZMSKVR-145) ProcessRedirect.php beim redirecten eines Termin wir…
MoDaae Mar 4, 2025
0872551
feat(ZMSKVR-145) Controller für die Twig Tabelle um withSumByHour erw…
MoDaae Mar 4, 2025
3f365d0
feat(ZMSKVR-145) reportWaitingIndex.twig Tabelle angepasst
MoDaae Mar 4, 2025
61b3931
feat(ZMSKVR-145) WorkstationProcessParked.php beim parken eines Termi…
MoDaae Mar 4, 2025
6c9adc5
feat(ZMSKVR-145) resolve merge conflicts from next
MoDaae Mar 4, 2025
c9b2ba0
feat(ZMSKVR-145) fix PHPCS formatting
MoDaae Mar 4, 2025
a09a21a
feat(ZMSKVR-145) Exchange.php withSumByHour löschen, WaitingReport.p…
MoDaae Mar 6, 2025
0432e01
feat(ZMSKVR-145) CalculateDailyWaitingStatisticByCron.php: fix NPath…
MoDaae Mar 6, 2025
fabb198
Merge remote-tracking branch 'origin/next' into feature-zmskvr-145-wa…
MoDaae Mar 6, 2025
ac070a7
feat(ZMSKVR-145) fix PHPCS errors
MoDaae Mar 6, 2025
addc7d8
feat(ZMSKVR-145) fix ReportWaitingDepartmentTest.php
MoDaae Mar 6, 2025
783c60c
feat(ZMSKVR-145) fix Unit-Tests
MoDaae Mar 6, 2025
e222bf2
feat(ZMSKVR-145) PR-Anpassungen
MoDaae Mar 10, 2025
1b9d14f
feat(ZMSKVR-145) Kommentare löschen
MoDaae Mar 10, 2025
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: 5 additions & 0 deletions zmsadmin/src/Zmsadmin/ProcessQueueReset.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public function readResponse(
if ($processId) {
$selectedProcess = \App::$http->readGetResult('/process/' . $processId . '/')->getEntity();
}

if (isset($selectedProcess->queue)) {
$selectedProcess->queue->arrivalTime = time();
}

\App::$http->readPostResult('/process/status/queued/', $selectedProcess);

return \BO\Slim\Render::redirect(
Expand Down
1 change: 1 addition & 0 deletions zmsapi/composer.lock

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

1 change: 1 addition & 0 deletions zmsapi/cron/cronjob.daily
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set +a
if [[ $ZMS_CRONROOT =~ ^1|on|true|yes$ ]]; then
if [[ $ZMS_ENV =~ ^prod|dev|stage$ ]]; then
$API config cron migrate|grep -q "$ZMS_ENV" && $BIN/migrate --update
$API config cron calculateDailyWaitingStatistic|grep -q "$ZMS_ENV" && $BIN/calculateDailyWaitingStatistic --commit
$API config cron archiveStatisticData|grep -q "$ZMS_ENV" && $BIN/archiveStatisticData --commit
$API config cron anonymizeStatisticData|grep -q "$ZMS_ENV" && $BIN/anonymizeStatisticData --commit
$API config cron resetGhostWorkstationCount|grep -q "$ZMS_ENV" && $BIN/resetGhostWorkstationCount --commit
Expand Down
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/ProcessFinished.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function readResponse(
);
(new Workstation())->writeRemovedProcess($workstation);
} else {
$query->writeEntityFinished($process, \App::$now, true, $workstation->getUseraccount());
$query->writeEntityFinished($process, \App::$now, false, $workstation->getUseraccount());
}

if ($survey) {
Expand Down
6 changes: 6 additions & 0 deletions zmsapi/src/Zmsapi/ProcessQueued.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public function readResponse(
$this->testProcessData($entity);
$process = (new Query())->readEntity($entity['id'], $entity['authKey'], 1);
$previousStatus = $process->status;
if (isset($entity->queue['waitingTime'])) {
$process->queue['waitingTime'] = $entity->queue['waitingTime'];
}
if (isset($entity->queue['arrivalTime'])) {
$process->queue['arrivalTime'] = $entity->queue['arrivalTime'];
}
$process->status = 'queued';
$process->queue['callCount'] = 0;
$process->queue['lastCallTime'] = 0;
Expand Down
47 changes: 8 additions & 39 deletions zmsapi/src/Zmsapi/ProcessRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,25 @@ class ProcessRedirect extends BaseController
* @SuppressWarnings(Param)
* @return String
*/
public function readResponse(
\Psr\Http\Message\RequestInterface $request,
\Psr\Http\Message\ResponseInterface $response,
array $args
) {
public function readResponse(\Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$workstation = (new Helper\User($request))->checkRights();
$input = Validator::input()->isJson()->assertValid()->getValue();
$entity = new \BO\Zmsentities\Process($input);
$newProcess = new \BO\Zmsentities\Process($input);
$process = $this->readValidProcess($workstation, $entity, $input, $workstation);
$newProcess->requests = new RequestList();

$this->testProcessAccess($workstation, $process);

\BO\Zmsdb\Connection\Select::getWriteConnection();
$processStatusArchived = new \BO\Zmsdb\ProcessStatusArchived();

$process->status = 'finished';
$process = (new Query())->updateEntity(
$process,
\App::$now,
0,
'processing',
$workstation->getUseraccount()
);
$process = (new Query())->updateEntity($process, \App::$now, 0, 'processing', $workstation->getUseraccount());
(new Workstation())->writeRemovedProcess($workstation);
$processStatusArchived->writeEntityFinished($process, \App::$now, true);

$newProcess = (new \BO\Zmsdb\Process())->redirectToScope(
$newProcess,
$process->scope,
$process->queue['number'] ?? $process->id,
$workstation->getUseraccount()
);

$processStatusArchived->writeEntityFinished($process, \App::$now, false);
$newProcess = (new \BO\Zmsdb\Process())->redirectToScope($newProcess, $process->scope, $process->queue['number'] ?? $process->id, $workstation->getUseraccount());
$message = Response\Message::create($request);
$message->data = $newProcess;
$response = Render::withLastModified($response, time(), '0');

return Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode());
}

Expand Down Expand Up @@ -95,25 +75,14 @@ protected function readValidProcess($workstation, $entity, $input)
if ($entity->hasProcessCredentials()) {
$this->testProcessData($entity);
$entity->addData($input);
$process = (new Query())->updateEntity(
$entity,
\App::$now,
0,
null,
$workstation->getUseraccount()
);
$process = (new Query())->updateEntity($entity, \App::$now, 0, null, $workstation->getUseraccount());
} elseif ($entity->hasQueueNumber()) {
// Allow waitingnumbers over 1000 with the fourth parameter
// Allow waitingnumbers over 1000 with the fourth parameter
$process = ProcessStatusQueued::init()
->readByQueueNumberAndScope($entity['queue']['number'], $workstation->scope['id'], 0, 100000000);
if (! $process->id) {
$workstation = (new \BO\Zmsdb\Workstation())->readResolvedReferences($workstation, 1);
$process = (new Query())->writeNewPickup(
$workstation->scope,
\App::$now,
$entity['queue']['number'],
$workstation->getUseraccount()
);
$process = (new Query())->writeNewPickup($workstation->scope, \App::$now, $entity['queue']['number'], $workstation->getUseraccount());
}
$process->testValid();
} else {
Expand Down
3 changes: 3 additions & 0 deletions zmsapi/src/Zmsapi/WorkstationProcessDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function readResponse(
throw new Exception\Process\ProcessNotFound();
}
$process = (new Query())->readEntity($workstation->process['id'], $workstation->process['authKey'], 1);
if ('called' == $workstation->process->status && $workstation->process->queue['callCount'] > $workstation->scope->getPreference('queue', 'callCountMax')) {
$process->setWasMissed(true);
}
$process = (new Query())->updateEntity(
$process,
\App::$now,
Expand Down
3 changes: 0 additions & 3 deletions zmsapi/src/Zmsapi/WorkstationProcessParked.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function readResponse(
throw new Exception\Process\ProcessNotFound();
}
$process = (new Query())->readEntity($workstation->process['id'], $workstation->process['authKey'], 1);

(new \BO\Zmsdb\ExchangeWaitingscope())->updateWaitingStatistics($process, \App::$now);

$previousStatus = $process->status;
$workstation->process->setStatus("parked");
$workstation->process->setStatusBySettings();
Expand Down
21 changes: 21 additions & 0 deletions zmsdb/bin/calculateDailyWaitingStatistic
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
/**
* calculate average waiting times for each scope, date, and hour,
* separated by 'spontan' vs. 'termin', and store results into wartenrstatistik.
*/
echo "calculateDailyWaitingStatistic: calculate average waiting times\n";
require_once(__DIR__."/script_bootstrap.php");

$verbose = in_array('--verbose', $argv);
$commit = in_array('--commit', $argv);

$targetDate = (new \DateTimeImmutable())->modify('-1 day');

$job = new BO\Zmsdb\Helper\CalculateDailyWaitingStatisticByCron();

$job->run($targetDate, $commit);

if (!$commit) {
echo "\n[DRY RUN] Nothing was written to the database. Use --commit to persist data.\n";
}
1 change: 1 addition & 0 deletions zmsdb/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"bin": [
"bin/archiveStatisticData",
"bin/anonymizeStatisticData",
"bin/calculateDailyWaitingStatistic",
"bin/calculateSlots",
"bin/calculateDayOffList",
"bin/deallocateAppointmentData",
Expand Down
46 changes: 27 additions & 19 deletions zmsdb/composer.lock

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

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `buerger` ADD COLUMN `wasMissed` BOOLEAN DEFAULT FALSE;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INSERT INTO `config` SET `name` = "cron__calculateDailyWaitingStatistic", `value` = "stage,dev,test,load,prod";
Loading
Loading