Skip to content

Show tickets before drawing winner#77

Open
saskim wants to merge 2 commits intoveloek:mainfrom
saskim:feat/show-tickets
Open

Show tickets before drawing winner#77
saskim wants to merge 2 commits intoveloek:mainfrom
saskim:feat/show-tickets

Conversation

@saskim
Copy link
Copy Markdown
Contributor

@saskim saskim commented Feb 1, 2026

WHAT

Show earned tickets and bonus tickets before spinning the lottery.
image

WHY

If an individual goal is set for a competition, we will show the bonus tickets for they who have reached the goal

HOW

Show bonus tickets before drawing winner

@saskim saskim force-pushed the feat/show-tickets branch from b6f9c5a to fcde2aa Compare February 1, 2026 17:59
@saskim saskim marked this pull request as ready for review February 1, 2026 17:59
ChrJohansen
ChrJohansen previously approved these changes Feb 20, 2026
@veloek
Copy link
Copy Markdown
Owner

veloek commented Feb 20, 2026

The why and how in the PR description looks like it's been copied from another PR :-)

<value>Athlete</value>
</data>
<data name="TicketsBase" xml:space="preserve">
<value>Base</value>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be called "Tickets" instead?

Suggested change
<value>Base</value>
<value>Tickets</value>

<value>Utøver</value>
</data>
<data name="TicketsBase" xml:space="preserve">
<value>Base</value>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Suggested change
<value>Base</value>
<value>Lodd</value>

{
private readonly Subject<FeedUpdate<Challenge>> _challengeFeed = new();

public readonly int ExtraTicketsWhenGoalReached = 10;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine that we keep this a constant for now, but perhaps we should make it configurable as part of the challenge at some point? Long running challenges, or hard individual goals probably deserves more bonus points 🙂

baseTickets += (int)(activity.Details.DistanceInMeters / 1000); // 1 km = 1 ticket
break;
case ChallengeMeasurement.Elevation:
baseTickets += (int)activity.Details.TotalElevationGain; // 1 m = 1 ticket
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should take the opportunity to adjust these measurements? It seems a bit strange that 1 meter elevation equals 1 km distance or 30 minutes duration..

It doesn't really matter as all athletes are compared by the same measure, but it will perhaps look a bit strange now that we get the tickets presented to us.

This is my initial suggestion, but please feel free to come with your opinion:
One tickets is granted for each:

  • 100 meters distance
  • 10 meters elevation
  • 1 minute duration
  • 10 kilocalories


public readonly int ExtraTicketsWhenGoalReached = 10;

private List<AthleteTickets> BuildChallengeTickets(Challenge challenge)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if this parameter could be called challengeWithAthleteActivities to be explicit about it's need for having the activities be populated. It's not perfect, but it's just a private method, and it might help the next developer know what this method expects.

An alternative would be to make the query inside this method and just pass it the challenge ID, but then you'd have to either return the challenge object or have to make a duplicated query in DrawChallengeWinnerAsync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants