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

Live viewer count #1037

Merged
merged 4 commits into from
May 24, 2023
Merged

Live viewer count #1037

merged 4 commits into from
May 24, 2023

Conversation

MatthiasReumann
Copy link
Collaborator

Motivation and Context

Resolves #1026

Description

Steps for Testing

  • 1 Livestream
  1. Log in
  2. /new
  3. View count should be visible.

Screenshots

image

@github-actions
Copy link

Your Testserver will be ready at https://1037.test.live.mm.rbg.tum.de in a few minutes.

Logins
Kurs1 Kurs2 Kurs3 Kurs4
public public loggedin enrolled
prof1 prof1 prof2 prof1
prof2
student1
student2
student3
student1
student2
student2
student3
student1
student2

api/courses.go Outdated
@@ -154,10 +155,14 @@ func (r coursesRoutes) getLive(c *gin.Context) {
lectureHall = &lh
}
}

var stat model.Stat
stat, err = r.StatisticsDao.GetStat(stream.ID)
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to just get this number from memory. The length of the chat session contains the number of viewers: https://github.com/joschahenningsen/TUM-Live/blob/a1c9209f5a875eab2967035d742ecab0b2e56fac/api/chat.go#LL661C43-L661C43

Would this be easier to implement and more efficient?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely. 👍🏻 However, we need to make sure to update this if we ever shard and distribute the chat as in #889.

Copy link
Member

@joschahenningsen joschahenningsen left a comment

Choose a reason for hiding this comment

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

Can you regenerate the mocks? Then this looks good to go!

@MatthiasReumann MatthiasReumann merged commit 885f688 into dev May 24, 2023
@MatthiasReumann MatthiasReumann deleted the enh/live-view-count branch May 24, 2023 18:06
SebiWrn pushed a commit that referenced this pull request May 7, 2024
* Add live view count

* Fix tests

* Use len(chat-sessions) instead of db query

* Regenerate mocks
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.

Show the number of live viewers next to livestreams
2 participants