File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,12 @@ <h3 class="m-0">
181181 </ tr >
182182 < tr >
183183 < th > {{'DashboardPage.Rating' | translate}}</ th >
184- < td > {{ongekiProfile.playerRating / 100 | number: '1.2-2'}}</ td >
184+ < ng-template [ngIf] ="compareVersion(ongekiProfile.lastRomVersion, '1.50.00', '>=') ">
185+ < td > {{ongekiProfile.newPlayerRating / 1000 | number: '0.2-2'}}</ td >
186+ </ ng-template >
187+ < ng-template [ngIf] ="compareVersion(ongekiProfile.lastRomVersion, '1.50.00', '<') ">
188+ < td > {{ongekiProfile.playerRating / 100 | number: '1.2-2'}}</ td >
189+ </ ng-template >
185190 </ tr >
186191 < tr >
187192 < th > {{'DashboardPage.BattlePoint' | translate}}</ th >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {LanguageService} from '../language.service';
1414import { HttpParams } from '@angular/common/http' ;
1515import { TranslateService } from '@ngx-translate/core' ;
1616import { Luid } from '../cards/cards.component' ;
17+ import { compareVersions } from 'compare-versions' ;
1718
1819@Component ( {
1920 selector : 'app-dashboard' ,
@@ -237,5 +238,23 @@ export class DashboardComponent implements OnInit {
237238 getFormattedNumberByDigit ( input : string , digit : number ) : string {
238239 return input . toString ( ) . padStart ( digit , '0' ) ;
239240 }
241+
242+ compareVersion ( version : string , target : string , operator : '>=' | '<' ) {
243+ const a = version . split ( '.' ) . map ( Number ) ;
244+ const b = target . split ( '.' ) . map ( Number ) ;
245+ const len = Math . max ( a . length , b . length ) ;
246+
247+ for ( let i = 0 ; i < len ; i ++ ) {
248+ const n1 = a [ i ] || 0 ;
249+ const n2 = b [ i ] || 0 ;
250+
251+ if ( n1 > n2 ) { return operator === '>=' ; }
252+ if ( n1 < n2 ) { return operator === '<' ; }
253+ }
254+ return operator === '>=' ;
255+ }
256+
257+
258+ protected readonly compareVersions = compareVersions ;
240259}
241260
You can’t perform that action at this time.
0 commit comments