forked from ariska/karung-web-admin
update fix daily data not showing because end date is null
This commit is contained in:
1 parent
513fe2870f
commit
7d9e62f0d7
1 file changed
+9
-4
@@ -896,7 +896,9 @@ def ensure_active_cycle(conn):
|
||||
conn.execute('UPDATE cycle_settings SET is_active = 1 WHERE id = ?', (latest_id,))
|
||||
|
||||
def parse_cycle_date(date_text, field_name):
|
||||
date_text = date_text.strip()
|
||||
if not date_text:
|
||||
return None
|
||||
date_text = str(date_text).strip()
|
||||
if not date_text:
|
||||
return None
|
||||
|
||||
@@ -946,7 +948,7 @@ def get_masuk_calendar_dates_for_lookup(date_text, counter_settings):
|
||||
return {stored_date}
|
||||
|
||||
def filter_data_by_cycle(data, cycle_start, cycle_end):
|
||||
if not cycle_start or not cycle_end:
|
||||
if not cycle_start:
|
||||
return []
|
||||
|
||||
filtered_data = []
|
||||
@@ -956,7 +958,7 @@ def filter_data_by_cycle(data, cycle_start, cycle_end):
|
||||
continue
|
||||
if item_date < cycle_start:
|
||||
continue
|
||||
if item_date > cycle_end:
|
||||
if cycle_end and item_date > cycle_end:
|
||||
continue
|
||||
|
||||
filtered_data.append(item)
|
||||
@@ -1120,11 +1122,14 @@ def is_api_request():
|
||||
return request.path.startswith('/api/')
|
||||
|
||||
def is_date_in_active_cycle(target_date, cycle_start, cycle_end):
|
||||
if not cycle_start or not cycle_end:
|
||||
if not target_date or not cycle_start:
|
||||
return False
|
||||
|
||||
if cycle_end:
|
||||
return cycle_start <= target_date <= cycle_end
|
||||
|
||||
return target_date >= cycle_start
|
||||
|
||||
def filter_data_by_date(data, target_date):
|
||||
filtered_data = []
|
||||
for item in data:
|
||||
|
||||
Reference in new issue
Block a user