Skip to content

Conversation

@ecarreras
Copy link
Member

This pull request introduces support for a new showTotal attribute in the indicator graph type, allowing users to control whether the total value is displayed. By default, showTotal is enabled unless explicitly set to "0". The changes also include updates to processing logic and comprehensive tests to verify the new behavior.

Indicator graph enhancements:

  • Added a new showTotal attribute to the Indicator class in ooui/graph/indicator.py, defaulting to True unless specified otherwise in the XML. This allows users to toggle the display of the total value.
  • Exposed a show_total property and updated the process method to include showTotal in the output only when enabled. [1] [2]

Testing and validation:

  • Added multiple tests in spec/graph/graph_spec.py to verify default behavior, explicit enabling/disabling, and correct output of showTotal.
  • Updated existing tests to check for the presence of showTotal in processed graph results.
  • Added a test in spec/graph/processor_spec.py to verify that disabling showTotal via XML omits it from the result. [1] [2]

@ecarreras ecarreras self-assigned this Nov 20, 2025
- Add showTotal attribute to GraphIndicator class with default value True
- Include showTotal in response when processing indicators
- Add comprehensive tests for showTotal functionality in both graph_spec.py and processor_spec.py
- Maintain backward compatibility with default showTotal=True
@ecarreras ecarreras force-pushed the 80812/add-show-total branch from 47fd77c to f8b0ba5 Compare November 20, 2025 15:57
@ecarreras ecarreras requested a review from Copilot November 20, 2025 16:00
@ecarreras ecarreras added the minor Create a Minor version label Nov 20, 2025
@ecarreras ecarreras merged commit 2a08d53 into main Nov 20, 2025
3 checks passed
@ecarreras ecarreras deleted the 80812/add-show-total branch November 20, 2025 16:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new showTotal attribute to the GraphIndicator class, allowing users to control whether the total value is displayed in indicator graphs. The attribute defaults to True when not specified and can be explicitly disabled by setting it to "0".

Key Changes:

  • Added showTotal attribute to GraphIndicator class with a default value of True
  • Modified the process method to always include showTotal in the response
  • Added comprehensive test coverage for default behavior, explicit enabling/disabling, and correct output

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ooui/graph/indicator.py Implemented _show_total attribute parsing, property accessor, and updated process method to include showTotal in output
spec/graph/graph_spec.py Added tests verifying default behavior, explicit enabling/disabling, and that showTotal is always present in responses
spec/graph/processor_spec.py Updated existing test to expect showTotal=True by default and added test for showTotal="0" behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

result = graph.process(50, 100)
expect(result).to(have_key('showTotal'))
expect(result['showTotal']).to(be_true)

Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

Trailing whitespace detected. This line should not have trailing whitespace.

Suggested change

Copilot uses AI. Check for mistakes.
res['progressbar'] = self.progressbar
if self.show_percent:
res['showPercent'] = self.show_percent
res['showTotal'] = self.show_total
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

Inconsistent API design: showTotal is always included in the response (line 80), while showPercent (line 78-79) and progressbar (line 76-77) are only included when True. Consider applying the same pattern for consistency - either always include all three boolean flags, or only include them when True. This inconsistency could confuse API consumers.

Suggested change
res['showTotal'] = self.show_total
if self.show_total:
res['showTotal'] = self.show_total

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Create a Minor version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants