Daniel Schädler
c758ddfe2b
Save match_scores explicitly after changing them
2019-05-13 11:06:52 +02:00
Daniel Schädler
f35ac4565d
Change the way, existing match_scores are handled
2019-05-13 11:06:34 +02:00
Daniel Schädler
16a38d141d
Move populating the match below to when the state is changed
2019-05-13 11:04:44 +02:00
Daniel Schädler
5df8714124
fixup evaluate_winner method match
2019-05-13 09:31:35 +02:00
Daniel Schädler
74282ea372
Rearrange methods in playoff_stage_service
2019-05-12 19:12:42 +02:00
Daniel Schädler
2c36a7aacc
Rearrange new methods into one to split it otherwise
2019-05-12 19:12:42 +02:00
Daniel Schädler
06ad5d56e5
Improve Formatting in playoff_stage_service (I guess)
...
... Rubocop wanted it that way
2019-05-12 19:12:42 +02:00
Daniel Schädler
5d5a58c2a3
Fix second match winner advancing, even if match is not finished
2019-05-12 19:12:42 +02:00
Daniel Schädler
0573651919
Check for errors while populating the match below
2019-05-12 19:12:42 +02:00
Daniel Schädler
6f8cb90dde
Implement PopulateMatchBelow Interactor & Organizer
2019-05-12 19:12:42 +02:00
Daniel Schädler
a7f337d14d
Implement populate_match_below method
2019-05-12 19:12:42 +02:00
Daniel Schädler
e04d3c1c2e
Call populate_match_below when a match is finished
2019-05-12 19:12:42 +02:00
Daniel Schädler
8fd09e3eca
Call calculate_group_points on Match_score Update
2019-05-12 19:12:42 +02:00
Daniel Schädler
ae652753c1
Implement calculate_group_points method
2019-05-12 19:12:42 +02:00
Daniel Schädler
a3c2f943cb
Move group_match method to public methods
...
This is done in order to check if a match is a group match within
Matches Controller
2019-05-12 19:12:42 +02:00
Daniel Schädler
c8879c64df
Add winner method to match
2019-05-12 19:12:42 +02:00
Daniel Schädler
4de6847edc
Add evaluate winner method
2019-05-12 19:12:42 +02:00
Daniel Schädler
a812e7103d
Change status of Match to only represent being finished
...
The winner will be a attribute of the Match instead of something
that is written in its status.
2019-05-12 19:12:42 +02:00
Daniel Schädler
c93af46072
Remove unused evaluate status method
2019-05-12 19:12:42 +02:00
Daniel Schädler
cb00cd7be8
Generalize tournament save interactor
...
It now is responsible for saving all ApplicationRecord objects to the
database. This will reduce code duplication one we have other objects
that need to be saved. (As we will soon need to save individual matches)
2019-05-12 19:12:42 +02:00
Daniel Schädler
787ed810d7
Remove link between team.owner and tournament
2019-05-12 19:09:50 +02:00
Thor77
27c4bcacc8
Respond with 501 for state param 'finished'
...
(501 = NOT IMPLEMENTED)
2019-05-07 18:41:53 +02:00
Thor77
3876f57d32
Add methods and specs to update a match
2019-05-07 18:41:53 +02:00
Thor77
436adde706
Set global match var for reuse by other methods
2019-05-07 18:41:52 +02:00
Thor77
1b9db61c22
Add owner method to Stage, Group and Match
2019-05-07 18:41:52 +02:00
Daniel Schädler
f7ed4b549d
Destroying all Readability.
...
Noone will ever be able to read this code again.
2019-05-04 20:54:08 +02:00
Daniel Schädler
23249ee93b
Build Matches without saving directly to database
2019-05-04 20:34:57 +02:00
Daniel Schädler
6a2c71bad7
Fix stage.team method not returning teams for playoff stages
2019-05-04 20:34:57 +02:00
Daniel Schädler
db1518bdbd
Raise exceptions upon error in group_stage_service
2019-05-04 20:34:57 +02:00
Daniel Schädler
bfadc7a6af
Dry out Tournaments Controller
2019-05-04 20:34:57 +02:00
Daniel Schädler
fdac71a9f1
Unnecessary variable assignment
2019-05-04 20:34:57 +02:00
Daniel Schädler
9053251706
Document group_stage generation parameter preparation
2019-05-04 20:34:57 +02:00
Daniel Schädler
f9b96cbee2
Indicate the groups variable being changed within the method
2019-05-04 20:34:57 +02:00
Daniel Schädler
74e9139b33
Removes unnecessary check
2019-05-04 20:34:57 +02:00
Daniel Schädler
acfc388da4
Implements group stage tournament creation
2019-05-04 20:34:57 +02:00
Daniel Schädler
f9b1b603f0
Permits "group_stage" as valid parameter for a create request
2019-05-04 20:34:57 +02:00
Daniel Schädler
a842e0db3c
Add group stage service
...
This service is responsible for all actions concerning the group stage
It returns false if no groups are given to generate_group_stage method
This prevents dividing by zero in the next line
2019-05-04 20:34:57 +02:00
Daniel Schädler
f7919ec0c6
Adds Organizer to Add a group stage to a tournament and save it
2019-05-04 20:34:57 +02:00
Daniel Schädler
83cd4ed340
Let Context Fail if there are any stages already in the tournament
2019-05-04 20:34:57 +02:00
Daniel Schädler
548d9241c4
Add Interactor to add group stage to a tournament
2019-05-04 20:34:57 +02:00
Daniel Schädler
26b8ff96c9
Add teams method to group,match,stage
...
It returns the unique teams that compete within the object
2019-05-04 20:34:57 +02:00
Thor77
2b72d0457e
Implement type parameter for tournaments index
2019-04-24 22:49:48 +02:00
Daniel Schädler
d3d572ea1b
Change return for 0 teams to exception
2019-04-23 14:21:29 +02:00
Daniel Schädler
a30ff860e9
Return a valid list of matches for 1 team
2019-04-23 14:19:36 +02:00
Daniel Schädler
38425df823
Only support stage count calculation for 1+ teams
2019-04-23 14:19:36 +02:00
Daniel Schädler
49a6545af9
Fix start point for stages with matchnumbers that are not powers of 2
2019-04-23 14:19:36 +02:00
Daniel Schädler
1c2d051364
Subtract one off required stages if the number of teams is a power of 2
...
This way we now calculate the right amount of stages for every number.
(I would test every number, but Jonas won't let me write tests for all of them..)
2019-04-23 14:19:36 +02:00
Thor77
22e547befa
Add validatable attribute to User model
...
to get email and password (existence) validation
2019-04-23 10:47:50 +02:00
Thor77
157844b4ae
Catch missing parameter exceptions to render error
2019-04-16 13:24:58 +02:00
Thor77
08d2ae59a5
Check teams array before calling create method
2019-04-16 13:24:58 +02:00