Exemple #1
0
 def _get_time_filter_query(self, timeFilter, facet):
     if 'fixed' in timeFilter:
         props = {}
         stat_facet = {'min': timeFilter['from'], 'max': timeFilter['to']}
         _compute_range_facet(facet['widgetType'], stat_facet, props,
                              stat_facet['min'], stat_facet['max'])
         gap = props['gap']
         unit = re.split('\d+', gap)[1]
         return {
             'start': '%(from)s/%(unit)s' % {
                 'from': timeFilter['from'],
                 'unit': unit
             },
             'end': '%(to)s/%(unit)s' % {
                 'to': timeFilter['to'],
                 'unit': unit
             },
             'gap': '%(gap)s' % props,  # add a 'auto'
         }
     else:
         gap = timeFilter['gap'][facet['widgetType']]
         return {
             'start': '%(from)s/%(unit)s' % {
                 'from': timeFilter['from'],
                 'unit': gap['unit']
             },
             'end': '%(to)s/%(unit)s' % {
                 'to': timeFilter['to'],
                 'unit': gap['unit']
             },
             'gap': '%(coeff)s%(unit)s/%(unit)s' % gap,  # add a 'auto'
         }
Exemple #2
0
 def _get_time_filter_query(self, timeFilter, facet):
   if 'fixed' in timeFilter:
     props = {}
     stat_facet = {'min': timeFilter['from'], 'max': timeFilter['to']}
     _compute_range_facet(facet['widgetType'], stat_facet, props, stat_facet['min'], stat_facet['max'])
     gap = props['gap']
     unit = re.split('\d+', gap)[1]
     return {
       'start': '%(from)s/%(unit)s' % {'from': timeFilter['from'], 'unit': unit},
       'end': '%(to)s/%(unit)s' % {'to': timeFilter['to'], 'unit': unit},
       'gap': '%(gap)s' % props, # add a 'auto'
     }
   else:
     gap = timeFilter['gap'][facet['widgetType']]
     return {
       'start': '%(from)s/%(unit)s' % {'from': timeFilter['from'], 'unit': gap['unit']},
       'end': '%(to)s/%(unit)s' % {'to': timeFilter['to'], 'unit': gap['unit']},
       'gap': '%(coeff)s%(unit)s/%(unit)s' % gap, # add a 'auto'
     }
Exemple #3
0
 def _get_time_filter_query(self, timeFilter, facet):
     if "fixed" in timeFilter:
         props = {}
         stat_facet = {"min": timeFilter["from"], "max": timeFilter["to"]}
         _compute_range_facet(facet["widgetType"], stat_facet, props, stat_facet["min"], stat_facet["max"])
         gap = props["gap"]
         unit = re.split("\d+", gap)[1]
         return {
             "start": "%(from)s/%(unit)s" % {"from": timeFilter["from"], "unit": unit},
             "end": "%(to)s/%(unit)s" % {"to": timeFilter["to"], "unit": unit},
             "gap": "%(gap)s" % props,  # add a 'auto'
         }
     else:
         gap = timeFilter["gap"][facet["widgetType"]]
         return {
             "start": "%(from)s/%(unit)s" % {"from": timeFilter["from"], "unit": gap["unit"]},
             "end": "%(to)s/%(unit)s" % {"to": timeFilter["to"], "unit": gap["unit"]},
             "gap": "%(coeff)s%(unit)s/%(unit)s" % gap,  # add a 'auto'
         }