Skip to content

Commit eebfbca

Browse files
committed
Merge branch 'dev' of https://github.com/terminusdb/terminus-client into dev
2 parents ada9578 + a5301b3 commit eebfbca

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

Readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ client.deleteDocument("http://localhost:6363/myFirstTerminusDB/document/chess",o
459459

460460
```
461461

462+
## Tutorials
463+
Visit [terminus-tutorials](https://github.com/terminusdb/terminus-tutorials) for tutorial scripts
464+
462465
## Testing
463466
* Clone this repository
464467

@@ -472,6 +475,12 @@ $ npm install
472475
$ npm run test
473476
```
474477

478+
## Report Issues
479+
480+
If you have encounter any issues, please report it with your os and environment setup, version that you are using and a simple reproducible case.
481+
482+
If you encounter other questions, you can ask in our community [forum](https://community.terminusdb.com/) or [Slack channel](http://bit.ly/terminusdb-slack).
483+
475484
## Contribute
476485
It will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.
477486

lib/woql.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,19 @@ WOQLQuery.prototype.file = function(json, opts){
711711
}
712712

713713
WOQLQuery.prototype.order_by = function(asc_or_desc, query){
714-
asc_or_desc = (asc_or_desc.json ? asc_or_desc.json() : asc_or_desc);
715-
this.cursor["order_by"] = [asc_or_desc]
714+
let ovars = [];
715+
if(Array.isArray(asc_or_desc)){
716+
for(var i = 0; i<asc_or_desc.length; i++){
717+
ovars.push(asc_or_desc[i].json ? asc_or_desc[i].json() : asc_or_desc[i])
718+
}
719+
}
720+
else if(typeof asc_or_desc == "string"){
721+
ovars.push({"asc": [asc_or_desc]});
722+
}
723+
else {
724+
ovars.push(asc_or_desc.json ? asc_or_desc.json() : asc_or_desc)
725+
}
726+
this.cursor["order_by"] = [ovars]
716727
if(query){
717728
this.cursor["order_by"] .push(query.json ? query.json() : query);
718729
}

test/woql.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,18 +365,18 @@ describe('woql queries', function () {
365365
})
366366

367367
it('check the order_by method',function(){
368-
const woqlObject=WOQL.order_by(WOQL.asc("v:B"));
369-
const jsonObj={ order_by: [ {asc: ['v:B']}, {} ] };
368+
const woqlObject=WOQL.order_by("v:B");
369+
const jsonObj={ order_by: [ [{asc: ['v:B']}], {} ] };
370370
expect(woqlObject.json()).to.eql(jsonObj);
371371

372372
const desc = WOQL.desc(["v:C", "v:A"]);
373373
const woqlObject2=WOQL.order_by(desc);
374-
const jsonObj2={ order_by: [ {desc: ['v:C', "v:A"]}, {} ] };
374+
const jsonObj2={ order_by: [ [{desc: ['v:C', "v:A"]}], {} ] };
375375
expect(woqlObject2.json()).to.eql(jsonObj2);
376376

377377
const ascd = WOQL.asc(["v:C", "v:A"]);
378378
const woqlObject3=WOQL.order_by(ascd);
379-
const jsonObj3={ order_by: [ {asc: ['v:C', "v:A"]}, {} ] };
379+
const jsonObj3={ order_by: [ [{asc: ['v:C', "v:A"]}], {} ] };
380380
expect(woqlObject3.json()).to.eql(jsonObj3);
381381

382382

0 commit comments

Comments
 (0)