Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/apps/api/serializers/competitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ class CompetitionSerializerSimple(serializers.ModelSerializer):
created_by = serializers.CharField(source='created_by.username', read_only=True)
owner_display_name = serializers.SerializerMethodField()
participants_count = serializers.IntegerField(read_only=True)
first_phase_start = serializers.DateTimeField(read_only=True)

class Meta:
model = Competition
Expand All @@ -467,6 +468,7 @@ class Meta:
'created_by',
'owner_display_name',
'created_when',
'first_phase_start',
'published',
'participants_count',
'logo',
Expand All @@ -477,8 +479,7 @@ class Meta:
'contact_email',
'report',
'is_featured',
'submissions_count',
'participants_count'
'submissions_count'
)

def get_created_by(self, obj):
Expand Down
7 changes: 7 additions & 0 deletions src/apps/competitions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ def bundle_dataset(self):
def all_organizers(self):
return [self.created_by] + list(self.collaborators.all())

@property
def first_phase_start(self):
first_phase = self.phases.filter(index=0).first()
if first_phase and first_phase.start:
return first_phase.start
return self.created_when

def user_has_admin_permission(self, user):
if isinstance(user, int):
try:
Expand Down
4 changes: 2 additions & 2 deletions src/static/riot/competitions/competition_list.tag
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<tr>
<th>Name</th>
<th width="100">Type</th>
<th width="125">Uploaded...</th>
<th width="125">Uploaded</th>
<th width="50px">Publish</th>
<th width="50px">Edit</th>
<th width="50px">Delete</th>
Expand Down Expand Up @@ -61,7 +61,7 @@
<thead>
<tr>
<th>Name</th>
<th width="125px">Uploaded...</th>
<th width="125px">Uploaded</th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/static/riot/competitions/public-list.tag
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</div>
</a>
<div class="comp-stats">
{pretty_date(competition.created_when)}
{pretty_date(competition.first_phase_start)}
<div if="{!competition.reward && ! competition.report}" class="ui divider"></div>
<div>
<span if="{competition.reward}"><img width="30" height="30" src="/static/img/trophy.png"></span>
Expand Down
2 changes: 1 addition & 1 deletion src/static/riot/competitions/tile/competition_tile.tag
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
</a>
<div class="comp-stats" id="compStats">
{pretty_date(created_when)}
{pretty_date(first_phase_start)}
<div if="{!reward && !report}" class="ui divider"></div>
<div>
<span if="{reward}"><img width="30" height="30" src="/static/img/trophy.png"></span>
Expand Down
2 changes: 1 addition & 1 deletion src/static/riot/profiles/profile_detail.tag
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</div>
</a>
<div class="comp-stats">
{pretty_date(competition.created_when)}
{pretty_date(competition.first_phase_start)}
<div if="{!competition.reward && ! competition.report}" class="ui divider"></div>
<div>
<span if="{competition.reward}"><img width="30" height="30" src="/static/img/trophy.png"></span>
Expand Down