Show the wining ratio

Hi, I created a private lobby for game, and I want to show the user current winning ratio.

The below is my database setup:
Game Lobby: Text
Player Team A/B: List of User
Winning Team: Text

These 3 users played 2 games in the same lobby.
Peter winning ratio: 100% as he wins 2 games
John winning ratio: 50% as he wins 1 game
Steve winning ratio: 0% as he wins 0 game

my question is:

  1. The database created the same lobby for two times, so I suppose somehow I can retrieve the data that how many games they played in the same lobby?

2: how can I make this calculation and display it?
Winning Ratio = User Winning Game / Total Game in Same Lobby

Thanks a lot

Hi there, @theronyuen… I’m pretty sure what you are trying to accomplish would be a lot easier if a team is a thing (data type) that has a field for a team name and a field that is a list of users, and a game has fields to store a list of teams and a winning team. That being said, is there a particular reason why you have the data type set up as you are showing?

Best…
Mike

Hi, Mike,

Yes, that’s because it’s for team basketball internal challenge, and user could be sometimes Team A , sometimes Team B, and people usually have multiple games in different team in one day. It’s like we having a group of friends, maybe 12-15 people go to play basketball, 5 vs 5, will have multiple games in one day, and end up everyone will have different teammate every game right? so if I ask them to build a new team every time, it could be lots of work on database?

So I currently using a custom state to allow them to choose their own Team A / B > Show up in a repeating group to separate Team A / B > Game start (Button) > Pick the Winner Team (Button) > Ask for Rematch or Leave Lobby (Pop Out)

if they choose to rematch, the page will refresh, then everyone will be in the same lobby, and then they can choose team A/B again and go for second game.

I was hoping that I could get the result when the day is done to see who has the highest / lowest wining ratio. Thanks

Best regard
Theron

For what it’s worth, I played around for a good amount of time with trying to get the win ratio using your current setup, and I kept hitting dead ends. That being said, I’m still not convinced that I couldn’t hack something together that produces the desired result, but the key word there is hack because it would definitely be hacky.

So, I am pretty firmly in the camp of you needing to change your set up. I would probably have data types called Lobby, Game, and Team. A lobby would have a list of games, games would have a list of teams and a winning team. and a team would have a list of users. With a more “structured” set up in place, I think it will be much easier to do what you are trying to do.

Thanks, problem is solved for now, and yes… its hacky.

I use the Math Expression Formula Calculator Plugin to do the math “Search for Game :filtered (Winner Team contain Current Cell’s User) :count / Search for Game :filtered (User in Game contain Current Cell’s User):count”

I also changed the data type to 3 list of user (Winner Team, Loser Team, User in Game) instead of Team A, Team B, Winner (text)… Because I think no one care they were on Team A or B, since they swap teammate all the time.

Thank you for helping out.