# 2 users competing

Hey all. Looking for some help on a (what i thought would be)simple app i’m trying to build. Essentially, people sign up and then create matches (“Big Boars” vs. other users. these Big Boards can go on infinitely and are measured as a plus or minus number (“Diff”). User 1 "diff " with User 2 would be +10 for example, but if he won the next match it would be +9 (because he won a point). Points would be entered via the app as a plus or minus by either user and would be displayed relative to the user: +9 for user 1 and conversely -9 for USer 2

one user may have multiple matches with different players. want to track and show the “diff” between players, but can’t find figure where to store it.

right now i have Data types of Users and Big Boards.

@timberlake.nate

It seems there is a need for a separate object that records these dynamic differences. Consider creating a thing called “difference” … populate it with the necessary fields to relate them to board and users . And create them when needed.

thanks @cmarchan. now, how would i specify which “difference” to change in a list of differences? I can figure out how to do the first, but would like to chose one based on parameters.
In other words, how to build it so:
Player 1 gets an extra point on Player 2 (therefore changing that difference)
and Player 1 loses a point agains Player 3 (changing that difference)

Hard to provide you with guidance that makes sense because I do not see/understand the macro picture on the dB model.

Instead of going down the rabbitt hole of the differences thing … why not just do the calculations based on comparing how one users number compares to another?

because Player 1’s number may be different against Player 2 than it is for Player 3

data structure:

Based on above … A difference is independant of the users involved correct?

… Why?

USER 1 vs. USER 2 creates the “Board For Diffs” and then the difference involves 2 users and that difference is unique to those 2 users.

Ok I think I understand.

I would redo the dB model as follows:

Board
-match users (list of users)
-differences (list of differences)

Difference
-difference (number)
-board

Upon the creation of a board I would add the two involved users … and build conditionality that avoids duplicating a board with the same two users

Having the dB model like this allows you to look up / find the corresponding board between two users in a much easier way because they will be contained within one field (the list field of match users). And their list of differences … This way you can keep track of all the differences created.

If you anticipate differences to be beyond 100 entries then do not use the list of differences on the board object. They would be inversely related via the board field in the difference object. Bubble becomes slower for list field beyond 100 entries.

Hopefully last thing - having a hard time pointing to a specific value to change rather than “first item”. how would i chose to change the difference assoociated with a certain match? Trying to reference current user and a field that identifies the other user in the match.

If you use the suggested new dB model then you can find a board by using “contains” or “is in” when looking up which users are part of a board (they will be in match users which is a list of 2 users).

When filtering after a search an advanced option opens up to use “contains list”. This is used when you want to know whether a list is contains another list. This is a slow and less performant approach … but it is an alternative nonetheless.

Hey @cmarchan - just wanted to thank you again for the help. Got it all squared away.

1 Like