-
Notifications
You must be signed in to change notification settings - Fork 272
feat: 🎸 Improved QueryObject to handle more fields #116
Conversation
The commit is to ensure the feature parity between frontend and backend QueryOjbect
Codecov Report
@@ Coverage Diff @@
## master #116 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 74 74
Lines 898 923 +25
Branches 211 224 +13
=====================================
+ Hits 898 923 +25
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good overall! left a couple thoughts 💬
also maybe should add a test for coverage? I think we can ignore the patch hit diff being <100%
but keeping total coverage near 100%
I think is our goal / ideal.
@@ -29,24 +29,31 @@ export default class Metrics { | |||
return this.metrics.map(m => m.label); | |||
} | |||
|
|||
private addMetric(metric: FormDataMetric) { | |||
static convertMetric(metric: FormDataMetric): Metric { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we call this cleanMetric
or something more descriptive? at first glance it's not clear what it's convert
ing to or from
row_limit?: number; | ||
order_desc?: boolean; | ||
is_timeseries?: boolean; | ||
prequeries?: any[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can prequeries
, extras
, and orderby
by something besides any
?
where: formData.where || '', | ||
}; | ||
|
||
const orgGroupby = formData.groupby || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure what org
meant for these vars initially, could just extract like
const { columns = [], groupby = [] } = formData;
// OR
const groupbySet = new Set([ ...formData.columns, ...formData.groupby ]);
const orgGroupby = formData.groupby || []; | ||
const orgColumns = formData.columns || []; | ||
const groupbySet = new Set(orgGroupby.concat(orgColumns)); | ||
const limit = formData.limit ? Number(formData.limit) : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does limit=0
have any weird query side effects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the original logic from viz.py
:
limit = int(form_data.get('limit') or 0)
back too 100% ! |
should I merge this PR? @williaster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🏆 Enhancements
The commit is to ensure the feature parity between frontend and backend
QueryOjbect