Skip to content

Commit

Permalink
Fix version sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubsy committed Aug 27, 2019
1 parent 8012862 commit c300ce6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/nbextension/neptune-notebook.js
Expand Up @@ -168,7 +168,7 @@ define([
$.ajax({
url: 'https://pypi.org/pypi/neptune-notebooks/json',
success: function (data) {
const latestVersion = Object.keys(data.releases).sort().pop();
const latestVersion = Object.keys(data.releases).sort(sortVersion).pop();
if (CURRENT_VERSION !== latestVersion) {
$('#neptune-upgrade-notice').show();
}
Expand All @@ -177,6 +177,19 @@ define([
})
}

function sortVersion(a, b) {
var partsA = a.split('.');
var partsB = b.split('.');
for (var i = 0; i < 3; i++) {
var numberA = parseInt(partsA[i], 10);
var numberB = parseInt(partsB[i], 10);
if (numberA !== numberB) {
return numberA - numberB;
}
}
return 0;
}

function getAccessToken(status, apiToken, callback, errorCallback) {
var decodedToken = {};
try {
Expand Down

0 comments on commit c300ce6

Please sign in to comment.