diff --git a/app/assets/v2/css/results.css b/app/assets/v2/css/results.css index b94fbc848d1..7ec81ae75cf 100644 --- a/app/assets/v2/css/results.css +++ b/app/assets/v2/css/results.css @@ -4,7 +4,7 @@ margin-right: 10px; } -.navbar{ +.navbar { background-color: #0d023b; } @@ -160,7 +160,6 @@ p.single-stat__fineprint { color: var(--gc-dark-grey); } - .bounty-status-breakdown { display: flex; align-items: center; @@ -228,6 +227,16 @@ p.single-stat__fineprint { height: auto; } +.hackathon-breakdown div { + width: 250px; + display: inline-block; + vertical-align: top; +} + +.hackathon-breakdown div img { + max-width: 250px; +} + @media screen and (max-width: 768px) { .content-block { diff --git a/app/dashboard/admin.py b/app/dashboard/admin.py index 0a23bcca48c..e14cc2f1bb1 100644 --- a/app/dashboard/admin.py +++ b/app/dashboard/admin.py @@ -272,7 +272,7 @@ class HackathonEventAdmin(admin.ModelAdmin): """The admin object for the HackathonEvent model.""" list_display = ['pk', 'img', 'name', 'start_date', 'end_date', 'explorer_link'] - readonly_fields = ['img', 'explorer_link'] + readonly_fields = ['img', 'explorer_link', 'stats'] def img(self, instance): """Returns a formatted HTML img node or 'n/a' if the HackathonEvent has no logo. diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 90efe415672..8f6171533ad 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -3376,6 +3376,21 @@ def __str__(self): """ return f'{self.name} - {self.start_date}' + @property + def bounties(self): + return Bounty.objects.filter(event=self).current() + + @property + def stats(self): + stats = { + 'range': f"{self.start_date.strftime('%m/%d/%Y')} to {self.end_date.strftime('%m/%d/%Y')}", + 'num_bounties': self.bounties.count(), + 'num_bounties_done': self.bounties.filter(idx_status='done').count(), + 'num_bounties_open': self.bounties.filter(idx_status='open').count(), + 'total_volume': sum(self.bounties.values_list('_val_usd_db', flat=True)), + } + return stats + def save(self, *args, **kwargs): """Define custom handling for saving HackathonEvent.""" from django.utils.text import slugify diff --git a/app/retail/templates/results.html b/app/retail/templates/results.html index a05f01ebef1..aa8fa7e1e4d 100644 --- a/app/retail/templates/results.html +++ b/app/retail/templates/results.html @@ -40,7 +40,7 @@
{{hackathon.1.num_bounties}} Bounties
+${{hackathon.1.total_volume|floatformat:0|intcomma}} In Prizes
+ {% endif %} +{{hackathon.1.range}}
+ View Prize Explorer +