-
Notifications
You must be signed in to change notification settings - Fork 0
Add percentage display to extras in spreadsheet #14
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,7 +242,14 @@ def get_shares_spreadsheet(self): | |
| current_row += 1 | ||
|
|
||
| for extra in self.extras.items: | ||
| row_data = [extra.name, extra.price] | ||
| percentage = (extra.price / subtotal) * 100 | ||
| if percentage == int(percentage): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Percentage Formatting Fails Due to PrecisionThe 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%"). |
||
| formatted_percentage = f"{int(percentage)}%" | ||
| else: | ||
| formatted_percentage = f"{percentage:.2f}%" | ||
| extra_name_with_percentage = f"{extra.name} ({formatted_percentage})" | ||
|
|
||
| row_data = [extra_name_with_percentage, extra.price] | ||
| for col_idx in range(person_count): | ||
| col_letter = chr(ord("C") + col_idx) | ||
| formula = ( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.