You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/04/11 21:28:24 UTC

[GitHub] GabeLoins commented on a change in pull request #4736: [Explore] Adding custom expressions to adhoc metrics

GabeLoins commented on a change in pull request #4736: [Explore] Adding custom expressions to adhoc metrics
URL: https://github.com/apache/incubator-superset/pull/4736#discussion_r180903869
 
 

 ##########
 File path: superset/assets/javascripts/explore/AdhocMetric.js
 ##########
 @@ -23,10 +68,29 @@ export default class AdhocMetric {
 
   equals(adhocMetric) {
     return adhocMetric.label === this.label &&
+      adhocMetric.expressionType === this.expressionType &&
+      adhocMetric.sqlExpression === this.sqlExpression &&
       adhocMetric.aggregate === this.aggregate &&
       (
         (adhocMetric.column && adhocMetric.column.column_name) ===
         (this.column && this.column.column_name)
       );
   }
+
+  isValid() {
+    if (this.expressionType === EXPRESSION_TYPES.SIMPLE) {
+      return !!(this.column && this.aggregate);
 
 Review comment:
   Airbnb js style guide prefer `!!` to `Boolean(...)`- not sure if we have a different style guide for this project, but I like their advice on the whole.
   
   https://github.com/airbnb/javascript#coercion--booleans

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services