update fix daily data not showing because end date is null

This commit is contained in:
Alberto-Audrix committed 2026-09-30 15:29:57 +07:00
1 parent 513fe2870f
commit 7d9e62f0d7
1 file changed
+10 -5
+10 -5
View File
@@ -896,7 +896,9 @@ def ensure_active_cycle(conn):
conn.execute('UPDATE cycle_settings SET is_active = 1 WHERE id = ?', (latest_id,)) conn.execute('UPDATE cycle_settings SET is_active = 1 WHERE id = ?', (latest_id,))
def parse_cycle_date(date_text, field_name): 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: if not date_text:
return None return None
@@ -946,7 +948,7 @@ def get_masuk_calendar_dates_for_lookup(date_text, counter_settings):
return {stored_date} return {stored_date}
def filter_data_by_cycle(data, cycle_start, cycle_end): def filter_data_by_cycle(data, cycle_start, cycle_end):
if not cycle_start or not cycle_end: if not cycle_start:
return [] return []
filtered_data = [] filtered_data = []
@@ -956,7 +958,7 @@ def filter_data_by_cycle(data, cycle_start, cycle_end):
continue continue
if item_date < cycle_start: if item_date < cycle_start:
continue continue
if item_date > cycle_end: if cycle_end and item_date > cycle_end:
continue continue
filtered_data.append(item) filtered_data.append(item)
@@ -1120,10 +1122,13 @@ def is_api_request():
return request.path.startswith('/api/') return request.path.startswith('/api/')
def is_date_in_active_cycle(target_date, cycle_start, cycle_end): 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 return False
return cycle_start <= target_date <= cycle_end if cycle_end:
return cycle_start <= target_date <= cycle_end
return target_date >= cycle_start
def filter_data_by_date(data, target_date): def filter_data_by_date(data, target_date):
filtered_data = [] filtered_data = []