File tree Expand file tree Collapse file tree 6 files changed +30
-73
lines changed
app/controllers/api/v0/results Expand file tree Collapse file tree 6 files changed +30
-73
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,14 @@ def index
126126
127127 # TODO: move this to rankings-page-api when migration to next is done so this can be properly precompute
128128 rankings = Rails . cache . fetch [ "rankings-page-api-next" , *cache_params , record_timestamp ] do
129- DbHelper . execute_cached_query ( cache_params , record_timestamp , query )
130- end
129+ rows = DbHelper . execute_cached_query ( cache_params , record_timestamp , query )
131130
132- rankings = rankings . to_a
131+ # As of writing this comment, we are maintaining two frontends.
132+ # Augmenting the attempts manually (instead of clever joining)
133+ # is the most reasonable compromise for backwards-compatibility.
134+ # Feel free to improve this once the React-Rails frontend is dead.
135+ Result . augment_attempts ( rows . as_json )
136+ end
133137
134138 render json : {
135139 rankings : rankings ,
Original file line number Diff line number Diff line change @@ -50,12 +50,17 @@ def index
5050 # TODO: move this to records-page-api when migration to next is done so this can be properly precompute
5151
5252 records = Rails . cache . fetch [ "records-page-api-next" , *cache_params , record_timestamp ] do
53- DbHelper . execute_cached_query ( cache_params , record_timestamp , query )
53+ rows = DbHelper . execute_cached_query ( cache_params , record_timestamp , query )
54+
55+ # As of writing this comment, we are maintaining two frontends.
56+ # Augmenting the attempts manually (instead of clever joining)
57+ # is the most reasonable compromise for backwards-compatibility.
58+ # Feel free to improve this once the React-Rails frontend is dead.
59+ Result . augment_attempts ( rows . as_json )
5460 end
55- records = records . to_a
5661
5762 render json : {
58- records : records . group_by { | r | r [ "event_id" ] } ,
63+ records : records . group_by { it [ "event_id" ] } ,
5964 timestamp : record_timestamp ,
6065 }
6166 end
Original file line number Diff line number Diff line change @@ -13,11 +13,7 @@ required:
1313 - round_type_id
1414 - round_id
1515 - format_id
16- - value1
17- - value2
18- - value3
19- - value4
20- - value5
16+ - attempts
2117 - best
2218 - average
2319 - regional_single_record
@@ -64,21 +60,11 @@ properties:
6460 format_id :
6561 type : string
6662 example : " a"
67- value1 :
68- type : integer
69- example : 126
70- value2 :
71- type : integer
72- example : 84
73- value3 :
74- type : integer
75- example : 91
76- value4 :
77- type : integer
78- example : 89
79- value5 :
80- type : integer
81- example : 85
63+ attempts :
64+ type : array
65+ items :
66+ type : integer
67+ example : 566
8268 best :
8369 type : integer
8470 example : 84
Original file line number Diff line number Diff line change @@ -13,11 +13,7 @@ required:
1313 - round_type_id
1414 - round_id
1515 - format_id
16- - value1
17- - value2
18- - value3
19- - value4
20- - value5
16+ - attempts
2117 - best
2218 - average
2319 - regional_single_record
@@ -64,21 +60,11 @@ properties:
6460 format_id :
6561 type : string
6662 example : " a"
67- value1 :
68- type : integer
69- example : 126
70- value2 :
71- type : integer
72- example : 84
73- value3 :
74- type : integer
75- example : 91
76- value4 :
77- type : integer
78- example : 89
79- value5 :
80- type : integer
81- example : 85
63+ attempts :
64+ type : array
65+ items :
66+ type : integer
67+ example : 566
8268 best :
8369 type : integer
8470 example : 84
Original file line number Diff line number Diff line change @@ -33,11 +33,5 @@ export function recordAttempts(
3333 | components [ "schemas" ] [ "Record" ]
3434 | components [ "schemas" ] [ "ExtendedResult" ] ,
3535) {
36- return cleanAttempts ( [
37- record . value1 ,
38- record . value2 ,
39- record . value3 ,
40- record . value4 ,
41- record . value5 ,
42- ] ) ;
36+ return cleanAttempts ( record . attempts ) ;
4337}
Original file line number Diff line number Diff line change @@ -1299,16 +1299,7 @@ export interface components {
12991299 round_id : string | null ;
13001300 /** @example a */
13011301 format_id : string ;
1302- /** @example 126 */
1303- value1 : number ;
1304- /** @example 84 */
1305- value2 : number ;
1306- /** @example 91 */
1307- value3 : number ;
1308- /** @example 89 */
1309- value4 : number ;
1310- /** @example 85 */
1311- value5 : number ;
1302+ attempts : number [ ] ;
13121303 /** @example 84 */
13131304 best : number ;
13141305 /** @example 88 */
@@ -1382,16 +1373,7 @@ export interface components {
13821373 round_id : string | null ;
13831374 /** @example a */
13841375 format_id : string ;
1385- /** @example 126 */
1386- value1 : number ;
1387- /** @example 84 */
1388- value2 : number ;
1389- /** @example 91 */
1390- value3 : number ;
1391- /** @example 89 */
1392- value4 : number ;
1393- /** @example 85 */
1394- value5 : number ;
1376+ attempts : number [ ] ;
13951377 /** @example 84 */
13961378 best : number ;
13971379 /** @example 88 */
You can’t perform that action at this time.
0 commit comments