@@ -19,6 +19,25 @@ export const ORDER_BY = {
19
19
SUBMISSION_END_DATE : 'submissionEndDate' ,
20
20
} ;
21
21
22
+ export function fixColorStyle ( registrant ) {
23
+ /* eslint-disable no-param-reassign */
24
+ // set default color
25
+ registrant . colorStyle = 'color: #555555' ; // grey
26
+ if ( registrant . rating ) {
27
+ if ( registrant . rating >= 2200 ) {
28
+ registrant . colorStyle = 'color: #EA1900' ; // red
29
+ } else if ( registrant . rating >= 1500 && registrant . rating <= 2199 ) {
30
+ registrant . colorStyle = 'color: #F2C900' ; // yellow
31
+ } else if ( registrant . rating >= 1200 && registrant . rating <= 1499 ) {
32
+ registrant . colorStyle = 'color: #4C50D9' ; // blue
33
+ } else if ( registrant . rating >= 900 && registrant . rating <= 1199 ) {
34
+ registrant . colorStyle = 'color: #258205' ; // green
35
+ }
36
+ }
37
+ /* eslint-disable no-param-reassign */
38
+ return registrant ;
39
+ }
40
+
22
41
/**
23
42
* Normalizes a regular challenge object received from the backend.
24
43
* NOTE: This function is copied from the existing code in the challenge listing
@@ -340,11 +359,7 @@ class ChallengesService {
340
359
341
360
if ( challenge ) {
342
361
registrants = await this . getChallengeRegistrants ( challenge . id ) ;
343
-
344
- // This TEMP fix to colorStyle, this will be fixed with issue #4530
345
- registrants = _ . map ( registrants , r => ( {
346
- ...r , colorStyle : 'color: #151516' ,
347
- } ) ) ;
362
+ registrants = _ . map ( registrants , registrant => fixColorStyle ( registrant ) ) ;
348
363
349
364
/* Prepare data to logged user */
350
365
if ( memberId ) {
0 commit comments