Skip to content

Commit

Permalink
update participant display
Browse files Browse the repository at this point in the history
  • Loading branch information
snopoke committed Feb 6, 2025
1 parent 08b37e3 commit f075dd4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/experiments/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def experiment_to_message_export_rows(experiment: Experiment, tags: list[str] =
experiment.get_llm_provider_model_name(raises=False),
experiment.public_id,
experiment.name,
session.participant.label,
session.participant.name,
session.participant.identifier,
session.participant.public_id,
_format_tags(message.tags.all()),
Expand Down
14 changes: 4 additions & 10 deletions apps/experiments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,15 +1283,6 @@ def create_anonymous(cls, team: Team, platform: str) -> "Participant":
team=team, platform=platform, identifier=f"anon:{public_id}", public_id=public_id, name="Anonymous"
)

@property
def label(self):
if self.is_anonymous:
suffix = str(self.public_id)[:6]
return f"Anonymous [{suffix}]"
if self.name:
return self.name
return self.identifier

@property
def is_anonymous(self):
return self.identifier == f"anon:{self.public_id}"
Expand All @@ -1308,9 +1299,12 @@ def global_data(self):
return {}

def __str__(self):
if self.is_anonymous:
suffix = str(self.public_id)[:6]
return f"Anonymous [{suffix}]"
if self.name:
return f"{self.name} ({self.identifier})"
elif self.user and self.user.get_full_name():
if self.user and self.user.get_full_name():
return f"{self.user.get_full_name()} ({self.identifier})"
return self.identifier

Expand Down
2 changes: 1 addition & 1 deletion templates/participants/single_participant_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="text-sm breadcrumbs" aria-label="breadcrumbs">
<ul>
<li><a href="{% url 'participants:participant_home' request.team.slug %}">Participants</a></li>
<li class="pg-breadcrumb-active" aria-current="page">{{ participant.label }}</li>
<li class="pg-breadcrumb-active" aria-current="page">{{ participant }}</li>
</ul>
</div>
{% endblock %}
Expand Down

0 comments on commit f075dd4

Please sign in to comment.