1
0
Fork 1
mirror of https://github.com/pretix/pretix-servicefees.git synced 2025-04-29 17:52:37 +02:00

improve readability suggested from code review

This commit is contained in:
Richard Schreiber 2025-03-11 16:40:05 +01:00
parent 18b02c7f63
commit 6a7594af23

View file

@ -154,13 +154,13 @@ def get_fees(
trs[key] = tr trs[key] = tr
base_values = sorted([(trs[key], value) for key, value in d.items()], key=lambda t: t[0].rate) base_values = sorted([(trs[key], value) for key, value in d.items()], key=lambda t: t[0].rate)
sum_base = sum(value for rule, value in base_values) sum_base = sum(value for key, value in base_values)
if sum_base: if sum_base:
fee_values = [ fee_values = [
(t[0], round_decimal(fee * t[1] / sum_base, event.currency)) (key, round_decimal(fee * value / sum_base, event.currency))
for t in base_values for key, value in base_values
] ]
sum_fee = sum(t[1] for t in fee_values) sum_fee = sum(value for key, value in fee_values)
# If there are rounding differences, we fix them up, but always leaning to the benefit of the tax # If there are rounding differences, we fix them up, but always leaning to the benefit of the tax
# authorities # authorities