
On Wed, Nov 11, 2020 at 06:22:53PM +0800, Li Yuanchao wrote:
+def get_job_query_range(condition_fields) + range = { start_time: {} } + start_date = condition_fields[:start_date] + end_date = condition_fields[:end_date] + + range[:start_time][:gte] = "#{start_date} 00:00:00" if start_date + range[:start_time][:lte] = "#{end_date} 23:59:59" if end_date
'start_date' and 'end_date' are both used once, so these two vars are not necessary.
you can just use
range[:start_time][:gte] = "#{condition_fields[:start_date]} 00:00:00" if start_date ^^^^^^^^^^ range[:start_time][:lte] = "#{condition_fields[:end_date]} 23:59:59" if end_date ^^^^^^^^
Thanks, Zhang Yuhang
Thanks, Yuanchao
+ + { range: range } +end