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

Fix zms 1500 rename sum and fix calulation #874

Merged
merged 9 commits into from
Feb 21, 2025

Conversation

msfb3
Copy link
Contributor

@msfb3 msfb3 commented Feb 14, 2025

Pull Request Checklist (Feature Branch to next):

  • Ich habe die neuesten Änderungen aus dem next Branch in meinen Feature-Branch gemergt.
  • Das Code-Review wurde abgeschlossen.
  • Fachliche Tests wurden durchgeführt und sind abgeschlossen.

Summary by CodeRabbit

  • New Features
    • Enhanced report generation with dynamic summary rows that aggregate totals and display all relevant data entries.
  • Refactor
    • Improved handling of request counts and streamlined report view rendering for a more consistent, user-friendly experience.

Copy link
Contributor

coderabbitai bot commented Feb 14, 2025

Walkthrough

The changes update the handling of report generation and data aggregation across multiple modules. In the Exchange class, the getGroupedHashSet method now ensures that the 'requestscount' value is cast to an integer if its position is valid. In the reporting functionality, the RequestReport class modifies the data collection and summary row formula generation, while the ReportRequestIndex class alters the control flow by removing a conditional report response. The Twig template is updated to process all data entries and correctly calculate totals.

Changes

File(s) Change Summary
zmsentities/.../Exchange.php Updated getGroupedHashSet method: retrieves and casts 'requestscount' as integer if valid.
zmsstatistic/.../Download/RequestReport.php, zmsstatistic/.../ReportRequestIndex.php, zmsstatistic/.../reportRequestIndex.twig Reporting updates: modified writeReportData for strict comparisons and summary row formulas; altered readResponse to directly render the index page; updated Twig template to aggregate and display complete data with total sums.

Sequence Diagram(s)

sequenceDiagram
  participant C as Client
  participant RI as ReportRequestIndex
  participant R as Renderer
  
  C->>RI: send report request (readResponse)
  RI->>RI: process request (check type, bypass report branch)
  RI->>R: invoke Render::withHtml for index page
  R->>C: return HTML response
Loading

Suggested reviewers

  • ThomasAFink

Poem

I hopped through lines of code with glee,
Casting counts and sums as neat as can be.
I tweaked reports with rhythm and rhyme,
Ensuring data sings in perfect time.
A rabbit’s cheer in every commit—hip, hip, hooray!
🥕🐇


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f399e2 and c87adcc.

📒 Files selected for processing (4)
  • zmsentities/src/Zmsentities/Exchange.php (2 hunks)
  • zmsstatistic/src/Zmsstatistic/Download/RequestReport.php (2 hunks)
  • zmsstatistic/src/Zmsstatistic/ReportRequestIndex.php (1 hunks)
  • zmsstatistic/templates/page/reportRequestIndex.twig (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: call-build-images / build (zmsticketprinter, 8.0)
  • GitHub Check: call-build-images / build (zmsstatistic, 8.0)
  • GitHub Check: call-build-images / build (zmsmessaging, 8.0)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: call-build-images / build (zmscitizenapi, 8.0)
  • GitHub Check: call-build-images / build (zmscalldisplay, 8.0)
  • GitHub Check: call-build-images / build (zmsapi, 8.0)
  • GitHub Check: call-build-images / build (zmsadmin, 8.0)
🔇 Additional comments (6)
zmsstatistic/src/Zmsstatistic/ReportRequestIndex.php (1)

48-56:

❓ Verification inconclusive

Verify the impact of removing the report download functionality.

The removal of the report response when type parameter is present could break the report download feature. Please ensure this change is intentional and verify that report downloads still work as expected.

Run this script to check for any references to this download functionality:


🏁 Script executed:

#!/bin/bash
# Search for references to report downloads
rg -A 5 'type.*RequestReport'

Length of output: 31


Impact of Removed Report Download Functionality

Our recent search for references to the download functionality (using “Download\RequestReport”) returned no results, which makes it difficult to fully gauge the impact of removing the early return when the type parameter is present. This change alters the control flow from directly sending a report response to continuing with HTML template rendering. Please verify that this change is intentional and that report downloads behave as expected under the new flow. In particular:

  • Confirm that endpoints expecting a downloadable report still receive the correct response when the type parameter is set.
  • Ensure that any consumer or test case relying on the original report download behavior is updated or properly handled.
zmsstatistic/src/Zmsstatistic/Download/RequestReport.php (2)

94-110: LGTM! Improved data collection logic.

The changes improve type safety and data organization by:

  • Using strict comparison for name checks
  • Explicitly casting requestscount to integer
  • Better structuring of row data

119-131: LGTM! Well-structured summary row calculation.

The implementation of the summary row calculation is clean and efficient, using Excel formulas for dynamic updates.

zmsstatistic/templates/page/reportRequestIndex.twig (2)

71-90: LGTM! Improved sum calculation logic.

The addition of totalSum calculation and its incremental update during iteration is clean and efficient.


126-134: LGTM! Enhanced date-wise sum calculation.

The implementation correctly calculates per-date sums across all entries.

zmsentities/src/Zmsentities/Exchange.php (1)

269-271: LGTM! Enhanced type safety for requestscount.

The addition of explicit type casting for requestscount ensures consistent integer values throughout the application.

@msfb3 msfb3 merged commit 7b4c489 into next Feb 21, 2025
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants