Skip to content

Commit

Permalink
fix bug sort on build
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslabbe committed Oct 4, 2016
1 parent 99a2daa commit 49cb05d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/cli/cms/data/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ export function escapeAbeValuesFromStringRequest(str, jsonPage) {
return str
}

/**
* analyse and create an object from request sql string
*
* Example: handleSqlRequest('select title from ./ where `abe_meta.template`=`{{article}}`', {article: "test"})
*
* @param {String} str Sql string request
* @param {Object} jsonPage json of post
* @return {Object} {type, columns, from, where, string, limit, orderby}
*/
export function handleSqlRequest(str, jsonPage) {
var req = escapeAbeValuesFromStringRequest(str, jsonPage)
var request = parse(req)
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/data/article-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"template": "article",
"link": "/article-1.json",
"status": "publish",
"date": "2016-08-11T16:40:41.974Z"
"date": "2016-08-11T16:40:41.974Z",
"latest": {"date": "2016-08-11T16:40:41.974Z"}
},
"priority":2,
"title":"article"
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/data/homepage-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"template": "homepage",
"link": "/homepage-1.json",
"status": "publish",
"date": "2016-07-11T16:40:41.974Z"
"date": "2016-07-11T16:40:41.974Z",
"latest": {"date": "2016-07-11T16:40:41.974Z"}
},
"title":"homepage",
"priority":1,
Expand Down
3 changes: 0 additions & 3 deletions test/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ describe('Sort', function() {
it('coreUtils.sort.byDateAsc', function() {
var list = Manager.instance.getList()
list.sort(coreUtils.sort.byDateAsc)
console.log('* * * * * * * * * * * * * * * * * * * * * * * * * * * * *')
console.log('list[0].name', list[0].name, list[0].date)
console.log('list[1].name', list[1].name, list[1].date)
chai.expect(list[0].name).to.contain('homepage');
});

Expand Down

0 comments on commit 49cb05d

Please sign in to comment.