-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
…d() hinzugefügt, addValuesWaitingTimeData angepasst um die Fälle im Story
aufruf von setWasMissed wenn Wiederhole aufgebraucht sind
…lbst wenn es sich, um einen Termin handelt (Verpasste Termine bekommen Aufnahmezeit zur Zeit der Aufnahme)
… Standort und Stunde
…mme der Wartende pro stunde über mehrere Tage zu rechnen
…irekt in Stats geschrieben
…icht in Stats geschrieben
…d nicht in Stats geschrieben
…n wird nicht in Stats geschrieben
WalkthroughThis update introduces several changes across the system. Process handling methods have been modified to update queue arrival times, adjust finished status flags, and conditionally mark processes as missed. A new daily statistic calculation feature has been added, comprising a cron command, a PHP script, and a helper class to calculate waiting times. In addition, database migrations and schema updates have been incorporated to support a new property for missed process tracking. Report templates and tests have been updated for terminology consistency, and formatting improvements have been applied to streamline method signatures and logging. Changes
Sequence Diagram(s)sequenceDiagram
participant Cron as CronJob
participant Script as DailyWaitingStatisticScript
participant Helper as CalculateDailyWaitingStatisticByCron
participant DB as Database
Cron->>Script: Invoke daily waiting statistic command
Script->>Helper: Instantiate helper and call run(day, commit)
Helper->>DB: Fetch citizen data (buerger)
Helper->>Helper: Process data and aggregate waiting times
alt commit flag set
Helper->>DB: Insert/update statistics in wartenrstatistik
else Dry run
Helper-->>Script: Output dry run message (no DB changes)
end
sequenceDiagram
participant WS as WorkstationProcessDelete (ReadResponse)
participant Proc as Process Object
WS->>WS: Check process status is "called" and callCount exceeds maximum
alt Conditions met
WS->>Proc: Call setWasMissed(true)
else
WS->>Proc: Proceed without marking as missed
end
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Note 🎁 Summarized by CodeRabbit FreeYour organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (3)
zmsentities/src/Zmsentities/Exchange.php (1)
127-153
: Consider logging skipped data and addressing pipeline formatting warning
Currently, if$date
does not match the specified pattern or$dateItems
is not an array, the code silently continues. If it's important to diagnose missing or malformed data, consider logging these events or raising exceptions. Additionally, storing results in$entity->data['sum']
may conflict if other sums are used; a more specific key name (e.g.'hourlySum'
) would enhance clarity.Also note that the pipeline reported a PHPCS formatting issue at line 131. You can remove the blank line before the
foreach
to comply:129 $entity = clone $this; 130 $sums = []; -131 132 foreach ($entity->data as $date => $dateItems) {
🧰 Tools
🪛 GitHub Actions: Combined Workflow
[error] 131-131: PHPCS: Blank line found at start of control structure. PHPCBF can fix this automatically.
zmsdb/src/Zmsdb/Query/Process.php (1)
916-944
: Complex waiting time condition
This logic checks multiple status transitions (queued → called, missed → queued, etc.). Consider separating these paths into smaller, self-describing methods or adding comprehensive test coverage to reduce complexity and ensure correctness for all scenarios.zmsdb/src/Zmsdb/Helper/CalculateDailyWaitingStatisticByCron.php (1)
19-21
: Use a dedicated logging mechanism instead of echo for CLI output.While
echo
works, the project's coding guidelines recommend using a CLI output handler or a PSR-3–compliant logger for better maintainability and configurability.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
zmsapi/composer.lock
is excluded by!**/*.lock
zmsdldb/composer.lock
is excluded by!**/*.lock
📒 Files selected for processing (20)
zmsadmin/src/Zmsadmin/ProcessQueueReset.php
(1 hunks)zmsapi/cron/cronjob.daily
(1 hunks)zmsapi/src/Zmsapi/ProcessFinished.php
(1 hunks)zmsapi/src/Zmsapi/ProcessQueued.php
(1 hunks)zmsapi/src/Zmsapi/ProcessRedirect.php
(4 hunks)zmsapi/src/Zmsapi/WorkstationProcessDelete.php
(1 hunks)zmsapi/src/Zmsapi/WorkstationProcessParked.php
(0 hunks)zmsdb/bin/calculateDailyWaitingStatistic
(1 hunks)zmsdb/composer.json
(1 hunks)zmsdb/migrations/91738315597-add-column-wasMissed-buerger.sql
(1 hunks)zmsdb/migrations/91740644959-calculateDailyWaitingStatistic.sql
(1 hunks)zmsdb/src/Zmsdb/Helper/CalculateDailyWaitingStatisticByCron.php
(1 hunks)zmsdb/src/Zmsdb/Process.php
(13 hunks)zmsdb/src/Zmsdb/Query/Process.php
(4 hunks)zmsentities/schema/process.json
(1 hunks)zmsentities/src/Zmsentities/Exchange.php
(2 hunks)zmsentities/src/Zmsentities/Process.php
(3 hunks)zmsentities/tests/Zmsentities/ProcessTest.php
(3 hunks)zmsstatistic/src/Zmsstatistic/ReportWaitingIndex.php
(1 hunks)zmsstatistic/templates/page/reportWaitingIndex.twig
(7 hunks)
💤 Files with no reviewable changes (1)
- zmsapi/src/Zmsapi/WorkstationProcessParked.php
✅ Files skipped from review due to trivial changes (3)
- zmsdb/migrations/91740644959-calculateDailyWaitingStatistic.sql
- zmsdb/migrations/91738315597-add-column-wasMissed-buerger.sql
- zmsdb/src/Zmsdb/Process.php
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.php`: Flag any usage of error_log() as it should be re...
**/*.php
: Flag any usage of error_log() as it should be replaced with proper logging mechanisms:
- For error handling: Use a proper logging framework with error levels (PSR-3 LoggerInterface)
- For debugging: Use a dedicated debug logger or remove debug statements
- For CLI output: Use a CLI output handler or symfony/console
- For application events: Use structured logging with proper log levels
Example replacement:
// Instead of: error_log("Import failed - " . $e->getMessage()); // Use: $logger->error("Import failed", ['error' => $e->getMessage()]);
zmsstatistic/src/Zmsstatistic/ReportWaitingIndex.php
zmsadmin/src/Zmsadmin/ProcessQueueReset.php
zmsapi/src/Zmsapi/ProcessQueued.php
zmsapi/src/Zmsapi/ProcessFinished.php
zmsapi/src/Zmsapi/ProcessRedirect.php
zmsentities/tests/Zmsentities/ProcessTest.php
zmsentities/src/Zmsentities/Process.php
zmsapi/src/Zmsapi/WorkstationProcessDelete.php
zmsentities/src/Zmsentities/Exchange.php
zmsdb/src/Zmsdb/Query/Process.php
zmsdb/src/Zmsdb/Helper/CalculateDailyWaitingStatisticByCron.php
🪛 GitHub Actions: Combined Workflow
zmsapi/src/Zmsapi/ProcessRedirect.php
[error] 1-1: ERROR | [x] Header blocks must be separated by a single blank line
[error] 9-9: ERROR | [x] Import statements must not begin with a leading backslash
[error] 10-10: ERROR | [x] Import statements must not begin with a leading backslash
[error] 12-12: ERROR | [x] Import statements must not begin with a leading backslash
[error] 13-13: ERROR | [x] Import statements must not begin with a leading backslash
[error] 44-44: ERROR | [x] Parentheses must be used when instantiating a new class
[error] 51-51: ERROR | [x] Parentheses must be used when instantiating a new class
[error] 81-81: ERROR | [x] Parentheses must be used when instantiating a new class
[error] 109-109: ERROR | [x] Parentheses must be used when instantiating a new class
zmsentities/src/Zmsentities/Exchange.php
[error] 131-131: PHPCS: Blank line found at start of control structure. PHPCBF can fix this automatically.
zmsdb/src/Zmsdb/Helper/CalculateDailyWaitingStatisticByCron.php
[error] 1-1: 19 errors found affecting 9 lines. Issues include: Import statements must not begin with a leading backslash, expected spaces around '=>', blank line found at start of control structure, and missing newline at end of file.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (23)
zmsdb/composer.json (1)
47-47
: Clean addition of new bin script.The addition of the "bin/calculateDailyWaitingStatistic" script to the composer.json file is properly placed within the existing "bin" section. This script appears to be part of the new waiting time statistics feature.
zmsadmin/src/Zmsadmin/ProcessQueueReset.php (1)
37-39
: Enhances queue tracking with arrival time.This new block properly sets the arrival time for a process queue when it exists, improving time tracking which is essential for waiting time statistics.
zmsapi/cron/cronjob.daily (1)
13-13
: Properly integrated new daily cron job.The addition of the calculateDailyWaitingStatistic job to the daily cronjob follows the same pattern as other entries, with appropriate environment checking before execution.
zmsapi/src/Zmsapi/WorkstationProcessDelete.php (1)
32-34
: Proper implementation of missed appointment tracking.This condition correctly identifies when a process should be marked as missed based on its status and call count, enhancing the data available for waiting time statistics.
zmsstatistic/src/Zmsstatistic/ReportWaitingIndex.php (1)
53-53
: Functional addition looks good!The addition of
withSumByHour(['waitingcount'])
to the method chain enhances the existing data processing by aggregating the waiting count data by hour.zmsapi/src/Zmsapi/ProcessQueued.php (1)
36-43
: Good enhancement for queue data handling.The new code correctly transfers the waiting time and arrival time from the request entity to the process entity when available, enhancing the queue data handling capabilities.
zmsentities/schema/process.json (1)
320-324
: Schema addition is well-structured.The new
wasMissed
property is well-defined with appropriate type, default value, and descriptive documentation. This addition will help track processes that were previously marked as missed.zmsdb/bin/calculateDailyWaitingStatistic (1)
1-21
: New script for calculating waiting statistics is well-implemented.The script is properly structured with:
- Clear documentation explaining its purpose
- Command-line argument handling for verbose output and commit control
- Appropriate error messaging for dry runs
- Logical flow for calculating statistics based on the previous day's data
This is a good addition to enhance the system's reporting capabilities.
zmsapi/src/Zmsapi/ProcessFinished.php (1)
50-50
: Logic change for process status recording.The boolean parameter to
writeEntityFinished
has been changed fromtrue
tofalse
, modifying how process completion is recorded in the database. This change aligns with the feature implementation for tracking waiting times properly.zmsentities/tests/Zmsentities/ProcessTest.php (3)
157-157
: Updated test expectation for waited seconds calculation.The expected value in the test has been significantly changed from a previous high value (53767) to a much smaller value (45), which indicates a fundamental change in how waiting time is calculated in the system.
173-173
: Updated test expectation for waited minutes calculation.Similar to the waited seconds test, the expected value has been substantially reduced from 896.1167 to 0.75 minutes, reflecting the change in waiting time calculation logic.
381-381
: Updated test expectation for arrival time.The expected arrival time in the queue list test has been changed to '1447922893' from a previous value, aligning with the new arrival time tracking feature in this pull request.
zmsstatistic/templates/page/reportWaitingIndex.twig (3)
57-57
: Updated column headers to indicate maximum values.The column headers now explicitly indicate that the values shown are maximum values by adding "(Max.)" to the date format, improving clarity for users.
Also applies to: 175-175
73-75
: Improved terminology for waiting time descriptions.The descriptions have been updated to use more precise terminology, changing from "gemessene Zeit" (measured time) to "Wartezeit" (waiting time) and adding "Durchschnittliche" (average) where appropriate. This improves user understanding of the displayed statistics.
Also applies to: 118-119, 191-195, 238-239
123-126
: Changed data source for waiting counts to use sum instead of max.The template now correctly references the
sum
data structure for waiting counts instead of using themax
structure, which provides more accurate statistics by aggregating data differently.Also applies to: 243-245
zmsentities/src/Zmsentities/Process.php (5)
52-53
: Verify default values for new properties
Setting'wasMissed' => false
by default is reasonable, but confirm that this aligns with overall missed-process logic. Also ensure'lastChange' => time()
is updated as intended throughout the entity's life cycle if it is truly meant to reflect the most recent modification.
576-587
: Confirm queue-based arrival overriding appointment arrival
The new logic makes queue arrival time take precedence over appointment time. Ensure that this behavior is correct for the business scenarios involving late arrivals or “verpasste” Termine.
595-599
: New setter method for arrivalTime
The straightforward assignment to$this->queue['arrivalTime']
looks good. No further issues.
624-629
: Added setWasMissed method
Implementation is clean. This setter aligns with the newly introducedwasMissed
property.
630-634
: Added getWasMissed method
Returning a strict boolean is appropriate. The method appears correct.zmsdb/src/Zmsdb/Query/Process.php (3)
245-245
: Ensure wasMissed column is present
Confirm that the database schema has thewasMissed
field to match this mapping. This is crucial for preventing undefined column errors.
687-687
: Adding wasMissed to the update logic
IncorporatingaddValuesWasMissed($process);
ensures the flag is consistently stored when updating. Looks good.
959-967
: New addValuesWasMissed implementation
Storing a boolean as1/0
is standard practice. Implementation is concise and consistent with the entity’swasMissed
property.
$workstation = (new \BO\Zmsdb\Workstation)->readResolvedReferences($workstation, 1); | ||
$process = (new Query())->writeNewPickup( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parentheses when instantiating a new class.
Parentheses must be used when instantiating a new class according to the coding standards.
Apply this fix:
- $workstation = (new \BO\Zmsdb\Workstation)->readResolvedReferences($workstation, 1);
+ $workstation = (new \BO\Zmsdb\Workstation())->readResolvedReferences($workstation, 1);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
$workstation = (new \BO\Zmsdb\Workstation)->readResolvedReferences($workstation, 1); | |
$process = (new Query())->writeNewPickup( | |
$workstation = (new \BO\Zmsdb\Workstation())->readResolvedReferences($workstation, 1); | |
$process = (new Query())->writeNewPickup( |
🧰 Tools
🪛 GitHub Actions: Combined Workflow
[error] 109-109: ERROR | [x] Parentheses must be used when instantiating a new class
$process = (new Query)->updateEntity( | ||
$process, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parentheses when instantiating a new class.
Parentheses must be used when instantiating a new class according to the coding standards.
Apply this fix:
- $process = (new Query)->updateEntity(
+ $process = (new Query())->updateEntity(
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
$process = (new Query)->updateEntity( | |
$process, | |
$process = (new Query())->updateEntity( | |
$process, |
🧰 Tools
🪛 GitHub Actions: Combined Workflow
[error] 44-44: ERROR | [x] Parentheses must be used when instantiating a new class
$cluster = (new \BO\Zmsdb\Cluster)->readByScopeId($workstation->scope['id'], 1); | ||
$workstation->testMatchingProcessScope($workstation->getScopeList($cluster), $process); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parentheses when instantiating a new class.
Parentheses must be used when instantiating a new class according to the coding standards.
Apply this fix:
- $cluster = (new \BO\Zmsdb\Cluster)->readByScopeId($workstation->scope['id'], 1);
+ $cluster = (new \BO\Zmsdb\Cluster())->readByScopeId($workstation->scope['id'], 1);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
$cluster = (new \BO\Zmsdb\Cluster)->readByScopeId($workstation->scope['id'], 1); | |
$workstation->testMatchingProcessScope($workstation->getScopeList($cluster), $process); | |
$cluster = (new \BO\Zmsdb\Cluster())->readByScopeId($workstation->scope['id'], 1); | |
$workstation->testMatchingProcessScope($workstation->getScopeList($cluster), $process); |
🧰 Tools
🪛 GitHub Actions: Combined Workflow
[error] 81-81: ERROR | [x] Parentheses must be used when instantiating a new class
use \BO\Slim\Render; | ||
use \BO\Mellon\Validator; | ||
use BO\Zmsdb\Process; | ||
use BO\Zmsdb\Process as Query; | ||
use BO\Zmsdb\ProcessStatusQueued; | ||
use \BO\Zmsdb\Process as Query; | ||
use \BO\Zmsdb\ProcessStatusQueued; | ||
use BO\Zmsdb\Workstation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove leading backslashes in import statements.
Import statements should not begin with leading backslashes as indicated by the pipeline failures.
Apply this fix:
-use \BO\Slim\Render;
-use \BO\Mellon\Validator;
use BO\Zmsdb\Process;
-use \BO\Zmsdb\Process as Query;
-use \BO\Zmsdb\ProcessStatusQueued;
use BO\Zmsdb\Workstation;
+use BO\Slim\Render;
+use BO\Mellon\Validator;
+use BO\Zmsdb\Process as Query;
+use BO\Zmsdb\ProcessStatusQueued;
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
use \BO\Slim\Render; | |
use \BO\Mellon\Validator; | |
use BO\Zmsdb\Process; | |
use BO\Zmsdb\Process as Query; | |
use BO\Zmsdb\ProcessStatusQueued; | |
use \BO\Zmsdb\Process as Query; | |
use \BO\Zmsdb\ProcessStatusQueued; | |
use BO\Zmsdb\Workstation; | |
use BO\Slim\Render; | |
use BO\Mellon\Validator; | |
use BO\Zmsdb\Process; | |
use BO\Zmsdb\Process as Query; | |
use BO\Zmsdb\ProcessStatusQueued; | |
use BO\Zmsdb\Workstation; |
🧰 Tools
🪛 GitHub Actions: Combined Workflow
[error] 9-9: ERROR | [x] Import statements must not begin with a leading backslash
[error] 10-10: ERROR | [x] Import statements must not begin with a leading backslash
[error] 12-12: ERROR | [x] Import statements must not begin with a leading backslash
[error] 13-13: ERROR | [x] Import statements must not begin with a leading backslash
(new Workstation)->writeRemovedProcess($workstation); | ||
$processStatusArchived->writeEntityFinished($process, \App::$now, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix class instantiation and note the changed boolean parameter.
Two issues to address:
- Parentheses must be used when instantiating a new class
- Note that the boolean parameter to
writeEntityFinished
has been changed fromtrue
tofalse
, matching the change in ProcessFinished.php
Apply this fix:
- (new Workstation)->writeRemovedProcess($workstation);
- $processStatusArchived->writeEntityFinished($process, \App::$now, false);
+ (new Workstation())->writeRemovedProcess($workstation);
+ $processStatusArchived->writeEntityFinished($process, \App::$now, false);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
(new Workstation)->writeRemovedProcess($workstation); | |
$processStatusArchived->writeEntityFinished($process, \App::$now, false); | |
(new Workstation())->writeRemovedProcess($workstation); | |
$processStatusArchived->writeEntityFinished($process, \App::$now, false); |
🧰 Tools
🪛 GitHub Actions: Combined Workflow
[error] 51-51: ERROR | [x] Parentheses must be used when instantiating a new class
'sid' => $scopeId, | ||
'd' => $dateStr | ||
]; | ||
$updateCols = []; | ||
|
||
// Für jede Stunde 0..23 Spalten für "spontan" und "termin" füllen | ||
foreach (range(0, 23) as $hour) { | ||
// Dynamische Spaltennamen für spontane Kunden | ||
$colWaitCountSp = sprintf('wartende_ab_%02d_spontan', $hour); | ||
$colWaitTimeSp = sprintf('echte_zeit_ab_%02d_spontan', $hour); | ||
$colWayTimeSp = sprintf('wegezeit_ab_%02d_spontan', $hour); | ||
|
||
$countSp = $hoursData[$hour]['spontan']['count']; | ||
$avgWaitSp= ($countSp > 0) | ||
? round($hoursData[$hour]['spontan']['sumWait'] / $countSp, 2) | ||
: 0.0; | ||
$avgWaySp= ($countSp > 0) | ||
? round($hoursData[$hour]['spontan']['sumWay'] / $countSp, 2) | ||
: 0.0; | ||
|
||
$updateCols[] = "`$colWaitCountSp` = :$colWaitCountSp"; | ||
$updateCols[] = "`$colWaitTimeSp` = :$colWaitTimeSp"; | ||
$updateCols[] = "`$colWayTimeSp` = :$colWayTimeSp"; | ||
|
||
$updateParams[$colWaitCountSp] = $countSp; | ||
$updateParams[$colWaitTimeSp] = $avgWaitSp; | ||
$updateParams[$colWayTimeSp] = $avgWaySp; | ||
|
||
// termin | ||
$colWaitCountTe = sprintf('wartende_ab_%02d_termin', $hour); | ||
$colWaitTimeTe = sprintf('echte_zeit_ab_%02d_termin', $hour); | ||
$colWayTimeTe = sprintf('wegezeit_ab_%02d_termin', $hour); | ||
|
||
$countTe = $hoursData[$hour]['termin']['count']; | ||
$avgWaitTe= ($countTe > 0) | ||
? round($hoursData[$hour]['termin']['sumWait'] / $countTe, 2) | ||
: 0.0; | ||
$avgWayTe= ($countTe > 0) | ||
? round($hoursData[$hour]['termin']['sumWay'] / $countTe, 2) | ||
: 0.0; | ||
|
||
$updateCols[] = "`$colWaitCountTe` = :$colWaitCountTe"; | ||
$updateCols[] = "`$colWaitTimeTe` = :$colWaitTimeTe"; | ||
$updateCols[] = "`$colWayTimeTe` = :$colWayTimeTe"; | ||
|
||
$updateParams[$colWaitCountTe] = $countTe; | ||
$updateParams[$colWaitTimeTe] = $avgWaitTe; | ||
$updateParams[$colWayTimeTe] = $avgWayTe; | ||
} | ||
|
||
$sqlUpdate = sprintf( | ||
"UPDATE wartenrstatistik | ||
SET %s | ||
WHERE standortid = :sid | ||
AND datum = :d | ||
LIMIT 1", | ||
implode(', ', $updateCols) | ||
); | ||
|
||
if ($commit) { | ||
$this->perform($sqlUpdate, $updateParams); | ||
} else { | ||
echo "[DRY RUN] update scope=$scopeId, date=$dateStr with stats.\n"; | ||
} | ||
} | ||
} | ||
|
||
echo "Done collecting stats for {$day->format('Y-m-d')}\n"; | ||
} | ||
|
||
private function extractScopeFromAnmerkung(?string $anmerkung, ?string $customText): ?int | ||
{ | ||
if (!$anmerkung && !$customText) { | ||
return null; | ||
} | ||
$pattern = "/'StandortID' => '(\d+)'/"; | ||
foreach ([$anmerkung, $customText] as $txt) { | ||
if (preg_match($pattern, (string)$txt, $matches)) { | ||
return (int)$matches[1]; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private function timeToMinutes(?string $timeStr): float | ||
{ | ||
if (!$timeStr || $timeStr === '00:00:00') { | ||
return 0.0; | ||
} | ||
$parts = explode(':', $timeStr); | ||
if (count($parts) !== 3) { | ||
return 0.0; | ||
} | ||
$h = (int)$parts[0]; | ||
$m = (int)$parts[1]; | ||
$s = (int)$parts[2]; | ||
$totalSeconds = $h * 3600 + $m * 60 + $s; | ||
return round($totalSeconds / 60, 2); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure consistent spacing around array key-value pairs.
The pipeline also flags several instances where spaces around =>
might not adhere to the required style. Review all array declarations to match the coding style consistently (e.g., key => value
).
🧰 Tools
🪛 GitHub Actions: Combined Workflow
[error] 1-1: 19 errors found affecting 9 lines. Issues include: Import statements must not begin with a leading backslash, expected spaces around '=>', blank line found at start of control structure, and missing newline at end of file.
namespace BO\Zmsdb\Helper; | ||
|
||
use BO\Zmsdb\Base; | ||
use \DateTimeImmutable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the leading backslash in the import statement to comply with coding standards.
According to the pipeline failure logs, import statements must not begin with a leading backslash.
- use \DateTimeImmutable;
+ use DateTimeImmutable;
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
use \DateTimeImmutable; | |
use DateTimeImmutable; |
AND Name NOT IN ('(abgesagt)') | ||
"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace to fix linting errors.
The pipeline logs indicate blank space issues, which can break strict code style rules.
- AND Name NOT IN ('(abgesagt)')
+ AND Name NOT IN ('(abgesagt)')
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
AND Name NOT IN ('(abgesagt)') | |
"; | |
AND Name NOT IN ('(abgesagt)') | |
"; |
$totalSeconds = $h * 3600 + $m * 60 + $s; | ||
return round($totalSeconds / 60, 2); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a newline at the end of the file.
The pipeline complains about a missing newline.
// End of file
-}
\ No newline at end of file
+}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
} | |
} |
…p anpassen um die benötigten Spalten, reportWaitingIndex.twig max statt sum für die Anzahl der Wartende über den Monat
…rtezeit-statistik
Pull Request Checklist (Feature Branch to
next
):next
Branch in meinen Feature-Branch gemergt.Summary by CodeRabbit
New Features
Bug Fixes