Skip to content

Commit

Permalink
fix(webapp): new version button is available even when a more recent …
Browse files Browse the repository at this point in the history
…version is used (#846)
  • Loading branch information
irvingoujAtDevolution authored May 8, 2024
1 parent f447381 commit 2b92c9a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions webapp/src/client/app/modules/base/menu/app-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ export class AppMenuComponent extends BaseComponent implements OnInit {
}

hasNewVersion() {
return this.version && this.latestVersion && !isSameVersion(this.version, this.latestVersion);
return this.version && this.latestVersion && compareVersion(this.version, this.latestVersion) < 0;
}

}

function isSameVersion(a: string, b: string): boolean {
const aParts = a.split('.').map(Number);
const bParts = b.split('.').map(Number);
for (let i = 0; i < Math.min(aParts.length,bParts.length); i++) {
if (aParts[i] !== bParts[i]) {
return false;
function compareVersion(a:string,b:string) {
const partsA = a.split('.');
const partsB = b.split('.');
for (let i = 0; i < partsA.length; i++) {
if (parseInt(partsA[i]) > parseInt(partsB[i])) {
return 1;
} else if (parseInt(partsA[i]) < parseInt(partsB[i])) {
return -1;
}
}

return true;
return 0;
}

0 comments on commit 2b92c9a

Please sign in to comment.