Skip to content

Commit

Permalink
added description to tracked columns
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierlacot committed Feb 21, 2011
1 parent e936984 commit 3020822
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Resources/js/lib/model/models.js
Expand Up @@ -14,9 +14,26 @@ var getMaxPosition = function() {
return 0;
}

return parseInt(result[0].max);
return parseInt(result[0].max, 10);
}
}
};

var getMaxId = function() {
var q = new joli.query()
.select('max(shorturl.id) as max')
.from('shorturl');
var result = q.execute();

if (!result.length) {
return 0;
} else {
if (null == result[0].max) {
return 0;
}

return parseInt(result[0].max, 10);
}
};

// define the models
var models = (function() {
Expand All @@ -28,6 +45,7 @@ var models = (function() {
columns: {
id: 'INTEGER',
created_at: 'TEXT',
description: 'TEXT',
longurl: 'TEXT',
media: 'TEXT',
position: 'INTEGER',
Expand All @@ -37,6 +55,7 @@ var models = (function() {
viewcount: 'INTEGER'
},
methods: {
getMaxId: getMaxId,
getMaxPosition: getMaxPosition
}
});
Expand Down

0 comments on commit 3020822

Please sign in to comment.