How to make a competition input form and a view? I want to put scores in a form. See screenprint:



Some details about it:


2 pulldown menu's with players.
2 text boxes for the score, example: (8) and (2).


In the above example, the automatically calculated "comp score" will be 3 and 1. If however the score is (6) and (6), then the comp score will be 1,5 and 1,5.

So to summarize (about how to calculate the "comp score":


When the score is equal both players get 1,5.
The winner gets 3, the loser gets 1.


They play in poules, several matches. Each match is put in like in the screenprint above.

The scores will be added up. And in a view they will be shown on the site as a ranking. The best on top.

I don't know how to imput the data, automatically give the comp score and how to add them up (to make the view will go).
To avoid writing a manual (to answer your question), here is a blueprint ...

Content type Game

Create a content type "game", with 2 entity ref fields to another content type like "player", and the other fields like date, etc.

3 Rules Components

Create 3 similar rules components (with parameters the score for player 1, and another parameter for score of player 2):


a 1st Rules Component with a Rules Condition to check if player1 has won, in which case you perform a 1st Rules Action to "set a data value" to set the "comp score" for player 1, and a similar 2nd Rules to set the "comp scrore" for player 2. Then add an extra Rules Action to save the entity (to ensure the comp value is also saved).
a (similar) 2nd Rules Component to check if player2 has won.
a 3rd , and one if the score was equal.


Custom rule

Create a custom rule like so:


Rules Event: before saving content of type "game"
Rules Actions: Perform 3 Actions, whereas each of these action performs one of the Rules Components create as described above.


Create a view games

Create a view of all your games. In doing so, use the Views Calc module to "add up the scores".

PS: I'm assuming this question is about D7.