Skip to content

Add percentage display to extras in spreadsheet#14

Merged
dphoria merged 3 commits intomasterfrom
feature/percentages-for-extras
Oct 19, 2025
Merged

Add percentage display to extras in spreadsheet#14
dphoria merged 3 commits intomasterfrom
feature/percentages-for-extras

Conversation

@dphoria
Copy link
Owner

@dphoria dphoria commented Oct 19, 2025

Updates the spreadsheet to display percentages for extra items (tax, tip, service charge, etc.) in the item name.

Changes:

  • Modifies get_shares_spreadsheet() to include calculated percentage in extra item names
  • Format: 'Tax (10.35%)' or 'Service charge (20%)'
  • Whole number percentages show without decimals
  • Non-whole percentages show with 2 decimal places
  • CSV output remains unchanged (no percentages)

commit 989319906069c1cecf7ed5bd8cee454d87ebcd3f
Author: Sung Cho <sung.w.cho@pm.me>
Date:   Sat Oct 18 20:59:51 2025 -0700

    download spreadsheet

commit b4b833a9a0e8f04daf2896f131f4ea7398702612
Author: Sung Cho <sung.w.cho@pm.me>
Date:   Sat Oct 18 20:53:50 2025 -0700

    get spreadsheet with formulas
cursor[bot]

This comment was marked as outdated.

@dphoria dphoria added the enhancement New feature or request label Oct 19, 2025
for extra in self.extras.items:
row_data = [extra.name, extra.price]
percentage = (extra.price / subtotal) * 100
if percentage == int(percentage):
Copy link

Choose a reason for hiding this comment

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

Bug: Percentage Formatting Fails Due to Precision

The direct floating-point equality check for whole number percentages can fail due to precision issues. This results in percentages that are effectively whole numbers being incorrectly formatted with decimals (e.g., "20.00%") instead of as clean whole numbers (e.g., "20%").

Fix in Cursor Fix in Web

@dphoria dphoria merged commit 4b35cea into master Oct 19, 2025
3 checks passed
@dphoria dphoria deleted the feature/percentages-for-extras branch October 19, 2025 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant