mirror of
https://github.com/pretix/pretix.git
synced 2025-12-13 12:42:26 +00:00
Compare commits
2 Commits
add-fixed-
...
v4.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e3f9178f5 | ||
|
|
03ea47715d |
@@ -19,4 +19,4 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
__version__ = "4.4.0.dev0"
|
__version__ = "4.4.0"
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Command(BaseCommand):
|
|||||||
order=OuterRef('pk')
|
order=OuterRef('pk')
|
||||||
).order_by().values('order').annotate(p=Sum('price')).values('p'),
|
).order_by().values('order').annotate(p=Sum('price')).values('p'),
|
||||||
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
||||||
), Value(Decimal(0)), output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
), Value(0), output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
||||||
),
|
),
|
||||||
fee_total=Coalesce(
|
fee_total=Coalesce(
|
||||||
Subquery(
|
Subquery(
|
||||||
@@ -51,7 +51,7 @@ class Command(BaseCommand):
|
|||||||
order=OuterRef('pk')
|
order=OuterRef('pk')
|
||||||
).order_by().values('order').annotate(p=Sum('value')).values('p'),
|
).order_by().values('order').annotate(p=Sum('value')).values('p'),
|
||||||
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
||||||
), Value(Decimal(0)), output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
), Value(0), output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
||||||
),
|
),
|
||||||
tx_total=Coalesce(
|
tx_total=Coalesce(
|
||||||
Subquery(
|
Subquery(
|
||||||
@@ -59,12 +59,12 @@ class Command(BaseCommand):
|
|||||||
order=OuterRef('pk')
|
order=OuterRef('pk')
|
||||||
).order_by().values('order').annotate(p=Sum(F('price') * F('count'))).values('p'),
|
).order_by().values('order').annotate(p=Sum(F('price') * F('count'))).values('p'),
|
||||||
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
||||||
), Value(Decimal(0)), output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
), Value(0), output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
||||||
),
|
),
|
||||||
).annotate(
|
).annotate(
|
||||||
correct_total=Case(
|
correct_total=Case(
|
||||||
When(Q(status=Order.STATUS_CANCELED) | Q(status=Order.STATUS_EXPIRED) | Q(require_approval=True),
|
When(Q(status=Order.STATUS_CANCELED) | Q(status=Order.STATUS_EXPIRED) | Q(require_approval=True),
|
||||||
then=Value(Decimal(0))),
|
then=Value(0)),
|
||||||
default=F('position_total') + F('fee_total'),
|
default=F('position_total') + F('fee_total'),
|
||||||
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
output_field=models.DecimalField(decimal_places=2, max_digits=10)
|
||||||
),
|
),
|
||||||
@@ -73,6 +73,9 @@ class Command(BaseCommand):
|
|||||||
tx_total=F('correct_total')
|
tx_total=F('correct_total')
|
||||||
).select_related('event')
|
).select_related('event')
|
||||||
for o in qs:
|
for o in qs:
|
||||||
|
if abs(o.tx_total - o.correct_total) < Decimal('0.00001') and abs(o.position_total + o.fee_total - o.total) < Decimal('0.00001'):
|
||||||
|
# Ignore SQLite which treats Decimals like floats…
|
||||||
|
continue
|
||||||
print(f"Error in order {o.full_code}: status={o.status}, sum(positions)+sum(fees)={o.position_total + o.fee_total}, "
|
print(f"Error in order {o.full_code}: status={o.status}, sum(positions)+sum(fees)={o.position_total + o.fee_total}, "
|
||||||
f"order.total={o.total}, sum(transactions)={o.tx_total}, expected={o.correct_total}")
|
f"order.total={o.total}, sum(transactions)={o.tx_total}, expected={o.correct_total}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user