Add more stats
All checks were successful
continuous-integration/drone/push Build is passing

* Finished (count)
* Unfinished (count)
* Refunded (count)
This commit is contained in:
2023-11-08 18:13:48 +01:00
parent 5052ca7dbf
commit e7ed349356
5 changed files with 119 additions and 52 deletions

View File

@ -33,6 +33,17 @@ class Edition(models.Model):
return self.name
class PurchaseQueryset(models.QuerySet):
def refunded(self):
return self.filter(date_refunded__isnull=False)
def not_refunded(self):
return self.filter(date_refunded__isnull=True)
def finished(self):
return self.filter(date_finished__isnull=False)
class Purchase(models.Model):
PHYSICAL = "ph"
DIGITAL = "di"
@ -53,6 +64,8 @@ class Purchase(models.Model):
(PIRATED, "Pirated"),
]
objects = PurchaseQueryset().as_manager()
edition = models.ForeignKey("Edition", on_delete=models.CASCADE)
platform = models.ForeignKey(
"Platform", on_delete=models.CASCADE, default=None, null=True, blank=True