Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broadcast stats WIP #15521

Merged
merged 4 commits into from
Jun 16, 2024
Merged

broadcast stats WIP #15521

merged 4 commits into from
Jun 16, 2024

Conversation

ornicar
Copy link
Collaborator

@ornicar ornicar commented Jun 15, 2024

What is done:

  • DB storage, recording and fetching stats of a tournament
  • Empty stats page linked on the tournament page when viewing as a study member

To do:

  • use chart.js to draw the viewers graph

On the stats page, the raw data is currently outputed with console.log.

It looks like this, should you need fixture data:

{ "points": [ [ 1718453040, 1 ], [ 1718453100, 1 ], [ 1718453160, 2 ], [ 1718453220, 5 ], [ 1718453280, 19 ], [ 1718453340, 100 ], [ 1718453640, 150 ], [ 1718453700, 579 ], [ 1718453760, 1200 ], [ 1718453820, 1120 ], [ 1718453880, 1099 ], [ 1718453940, 800 ], [ 1718454000, 5 ], [ 1718454060, 0 ], [ 1718454240, 4 ], [ 1718454300, 4 ], ] }

The first number 1718454300 is a timestamp in seconds. The second number 4 is the number of viewers at that moment.
There is one data point per minute. Data points are missing when the number of viewers is zero.

There are several usage examples of chart.js within the lila codebase.

ornicar added 2 commits June 15, 2024 15:39
What is done:
- DB storage, recording and fetching stats of a tournament
- Empty stats page linked on the tournament page

To do:
- use chart.js to draw the viewers graph
@allanjoseph98
Copy link
Member

Will do. Instead of having one long [number, number][] can we have

interface RoundStats = {
roundName: string,
spectators: [number, number][]
}[]

To differentiate between rounds in quick succession (say an Armageddon round immediately after a classical).

Vision is to have a rounds dropdown selector and view a separate graph per round instead of one long disjoint one.

@ornicar
Copy link
Collaborator Author

ornicar commented Jun 16, 2024

{
    "rounds": [
        {
            "round": {
                "id": "zfJOb9Cd",
                "name": "Round 1",
                "slug": "round-1",
                "createdAt": 1718451846258,
                "ongoing": true,
                "startsAt": 1718543400000
            },
            "viewers": [
                [ 1718561220, 1 ],
                [ 1718561280, 1 ],
                [ 1718561340, 1 ],
                [ 1718561400, 1 ],

@ornicar ornicar merged commit 41e3db1 into master Jun 16, 2024
8 checks passed
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.

2 participants