@@ -16,17 +16,18 @@ class ContestsHelperTest < ActionView::TestCase
1616 submissions . each_with_index { |x , i | x . created_at = start_time + i + 1 }
1717 expected_result = {
1818 result : {
19- "1_1 " => [
19+ "user_1_1 " => [
2020 { timestamp : 1000000 , state : [ 50 , true , 0 ] } ,
2121 { timestamp : 2000000 , state : [ 70 , true , 0 ] } ,
2222 { timestamp : 3000000 , state : [ 70 , true , 1 ] } ,
2323 { timestamp : 5000000 , state : [ 70 , true , 2 ] } ,
2424 ] ,
2525 } ,
2626 participants : [ 1 ] ,
27- first_ac : { 1 => 1 } ,
27+ teams : [ ] ,
28+ first_ac : { 1 => "user_1" } ,
2829 }
29- assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi' )
30+ assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi' , { } )
3031 end
3132
3233 test "ranklist_data ioi-style negative score is correct" do
@@ -43,14 +44,15 @@ class ContestsHelperTest < ActionView::TestCase
4344 submissions . each_with_index { |x , i | x . created_at = start_time + i + 1 }
4445 expected_result = {
4546 result : {
46- "1_1 " => [ { timestamp : 2000000 , state : [ -10 , true , 0 ] } ] ,
47- "1_2 " => [ { timestamp : 4000000 , state : [ 0 , true , 0 ] } ] ,
48- "1_3 " => [ { timestamp : 6000000 , state : [ -10 , true , 0 ] } ] ,
47+ "user_1_1 " => [ { timestamp : 2000000 , state : [ -10 , true , 0 ] } ] ,
48+ "user_1_2 " => [ { timestamp : 4000000 , state : [ 0 , true , 0 ] } ] ,
49+ "user_1_3 " => [ { timestamp : 6000000 , state : [ -10 , true , 0 ] } ] ,
4950 } ,
5051 participants : [ 1 ] ,
52+ teams : [ ] ,
5153 first_ac : { } ,
5254 }
53- assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi' )
55+ assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi' , { } )
5456 end
5557
5658 test "ranklist_data ioi-style should not display Validating score" do
@@ -63,15 +65,16 @@ class ContestsHelperTest < ActionView::TestCase
6365 submissions . each_with_index { |x , i | x . created_at = start_time + i + 1 }
6466 expected_result = {
6567 result : {
66- "1_1 " => [
68+ "user_1_1 " => [
6769 { timestamp : 1000000 , state : [ 10 , true , 0 ] } ,
6870 { timestamp : 2000000 , state : [ 10 , true , 1 ] } ,
6971 ] ,
7072 } ,
7173 participants : [ 1 ] ,
74+ teams : [ ] ,
7275 first_ac : { } ,
7376 }
74- assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi' )
77+ assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi' , { } )
7578 end
7679
7780 test "ranklist_data acm-style score & first_ac is correct" do
@@ -91,19 +94,20 @@ class ContestsHelperTest < ActionView::TestCase
9194 submissions . each_with_index { |x , i | x . created_at = start_time + i + 1 }
9295 expected_result = {
9396 result : {
94- "1_1 " => [
97+ "user_1_1 " => [
9598 { timestamp : 1000000 , state : [ 1 , nil , 0 ] } ,
9699 { timestamp : 3000000 , state : [ 1 , nil , 1 ] } ,
97100 { timestamp : 4000000 , state : [ 2 , 4000000 , 0 ] } ,
98101 ] ,
99- "2_1 " => [ { timestamp : 7000000 , state : [ 1 , 7000000 , 0 ] } ] ,
100- "1_2 " => [ { timestamp : 9000000 , state : [ 1 , 9000000 , 0 ] } ] ,
101- "2_2 " => [ { timestamp : 8000000 , state : [ 1 , 8000000 , 0 ] } ] ,
102+ "user_2_1 " => [ { timestamp : 7000000 , state : [ 1 , 7000000 , 0 ] } ] ,
103+ "user_1_2 " => [ { timestamp : 9000000 , state : [ 1 , 9000000 , 0 ] } ] ,
104+ "user_2_2 " => [ { timestamp : 8000000 , state : [ 1 , 8000000 , 0 ] } ] ,
102105 } ,
103106 participants : [ 1 , 2 ] ,
104- first_ac : { 1 => 1 , 2 => 2 } ,
107+ teams : [ ] ,
108+ first_ac : { 1 => "user_1" , 2 => "user_2" } ,
105109 }
106- assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'acm' )
110+ assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'acm' , { } )
107111 end
108112
109113 test "ranklist_data acm-style freeze is correct" do
@@ -119,20 +123,21 @@ class ContestsHelperTest < ActionView::TestCase
119123 submissions . each_with_index { |x , i | x . created_at = start_time + i + 1 }
120124 expected_result = {
121125 result : {
122- "1_1 " => [
126+ "user_1_1 " => [
123127 { timestamp : 1000000 , state : [ 1 , nil , 0 ] } ,
124128 { timestamp : 2000000 , state : [ 1 , nil , 1 ] } ,
125129 ] ,
126- "2_1 " => [
130+ "user_2_1 " => [
127131 { timestamp : 3000000 , state : [ 0 , nil , 1 ] } ,
128132 { timestamp : 4000000 , state : [ 0 , nil , 2 ] } ,
129133 { timestamp : 5000000 , state : [ 0 , nil , 3 ] } ,
130134 ] ,
131135 } ,
132136 participants : [ 1 , 2 ] ,
137+ teams : [ ] ,
133138 first_ac : { } ,
134139 }
135- assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'acm' )
140+ assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'acm' , { } )
136141 end
137142
138143 test "ranklist_data new-ioi-style score is correct" do
@@ -160,15 +165,16 @@ class ContestsHelperTest < ActionView::TestCase
160165 submissions . each { |x | x . generate_subtask_result ( true ) }
161166 expected_result = {
162167 result : {
163- "1_1 " => [
168+ "user_1_1 " => [
164169 { timestamp : 1000000 , state : [ 50 , true , 0 ] } ,
165170 { timestamp : 2000000 , state : [ 80 , true , 0 ] } ,
166171 ] ,
167172 } ,
168173 participants : [ 1 ] ,
174+ teams : [ ] ,
169175 first_ac : { } ,
170176 }
171- assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi_new' )
177+ assert_equal expected_result , ranklist_data ( submissions , start_time , freeze_start , 'ioi_new' , { } )
172178 end
173179
174180 test "ranklist_data should count ignored participant" do
@@ -179,7 +185,7 @@ class ContestsHelperTest < ActionView::TestCase
179185 start_time = Time . new ( 2022 , 1 , 1 , 0 , 0 , 0 )
180186 freeze_start = Time . new ( 2022 , 1 , 1 , 1 , 0 , 0 )
181187 submissions . each_with_index { |x , i | x . created_at = start_time + i + 1 }
182- assert_equal [ 1 , 2 ] , ranklist_data ( submissions , start_time , freeze_start , 'acm' ) [ :participants ]
183- assert_equal [ 1 , 2 ] , ranklist_data ( submissions , start_time , freeze_start , 'ioi' ) [ :participants ]
188+ assert_equal [ 1 , 2 ] , ranklist_data ( submissions , start_time , freeze_start , 'acm' , { } ) [ :participants ]
189+ assert_equal [ 1 , 2 ] , ranklist_data ( submissions , start_time , freeze_start , 'ioi' , { } ) [ :participants ]
184190 end
185191end
0 commit comments