williaster 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_r180896732
 
 

 ##########
 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:
   `Boolean()` also works fyi

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to