Skip to content

Commit bd9fbfe

Browse files
committed
fix queryExecutionTime parsing
1 parent fd7119c commit bd9fbfe

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/statistics.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ module.exports ={
4444
let value = this.getStringValue(label);
4545
return value ? parseInt(value) : 0;
4646
}
47+
48+
getFLoatValue(label) {
49+
let value = this.getStringValue(label);
50+
return value ? parseFloat(value) : 0;
51+
}
52+
4753

4854
nodesCreated() {
4955
return this.getIntValue(Label.NODES_CREATED);
@@ -70,7 +76,7 @@ module.exports ={
7076
}
7177

7278
queryExecutionTime() {
73-
return this.getIntValue(Label.QUERY_INTERNAL_EXECUTION_TIME);
79+
return this.getFLoatValue(Label.QUERY_INTERNAL_EXECUTION_TIME);
7480
}
7581

7682
}

test/redisGraphAPITest.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ describe('RedisGraphAPI Test', () =>{
2424
assert.ifError(result.getStatistics().getStringValue(Label.RELATIONSHIPS_CREATED));
2525
assert.ifError(result.getStatistics().getStringValue(Label.RELATIONSHIPS_DELETED));
2626
assert.equal(2, result.getStatistics().propertiesSet());
27-
assert.ok(result.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME));
27+
assert.ok( result.getStatistics().queryExecutionTime()); // not 0
28+
assert.ok(result.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); // exsits
2829
});
2930
});
3031

@@ -74,6 +75,8 @@ describe('RedisGraphAPI Test', () =>{
7475
.then( (resultSet) => {
7576
assert.ok(resultSet.hasNext());
7677
assert.equal(0, resultSet.getStatistics().nodesCreated());
78+
assert.equal(0, resultSet.getStatistics().nodesDeleted());
79+
assert.equal(0, resultSet.getStatistics().labelsAdded());
7780
assert.equal(0, resultSet.getStatistics().propertiesSet());
7881
assert.equal(0, resultSet.getStatistics().relationshipsCreated());
7982
assert.equal(0, resultSet.getStatistics().relationshipsDeleted());

0 commit comments

Comments
 (0)