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/18 04:00:34 UTC

[GitHub] mistercrunch commented on a change in pull request #4821: Fix time granularity-related issues

mistercrunch commented on a change in pull request #4821: Fix time granularity-related issues
URL: https://github.com/apache/incubator-superset/pull/4821#discussion_r182303026
 
 

 ##########
 File path: superset/models/core.py
 ##########
 @@ -786,7 +786,12 @@ def grains(self):
         return self.db_engine_spec.time_grains
 
     def grains_dict(self):
-        return {grain.duration: grain for grain in self.grains()}
+        """Allowing to lookup grain by either label or duration
+
+        For backward compatibility"""
+        d = {grain.duration: grain for grain in self.grains()}
+        d.update({grain.label: grain for grain in self.grains()})
 
 Review comment:
   Looks ok. The dropdown uses the `grains` property, not `grains_dict`.

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