Skip to content

Commit

Permalink
done added debug query to the daily metric
Browse files Browse the repository at this point in the history
  • Loading branch information
luutuankiet committed Feb 22, 2024
1 parent c5356b0 commit 64e9ac3
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions app/charts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ def get_table_nocache(query):
group by due_date_id
"""
today_table = get_table_nocache(today_table_query)
today_table = get_table_nocache(today_table_query).reset_index()
overdue_count = today_table[today_table['due_date_id'] < pd.to_datetime(datetime.datetime.now().date())]
overdue_count = overdue_count['cnt'].iloc[0]
overdue_count = overdue_count['cnt'].iloc[0] if overdue_count.shape[0] > 0 else 0

today_count = today_table[today_table['due_date_id'] == pd.to_datetime(datetime.datetime.now().date())]
today_count = today_count['cnt'].iloc[0]
Expand All @@ -214,10 +214,11 @@ def get_table_nocache(query):
delta_color="inverse"
)
with st.expander("query"):
debug_today__count=get_table_nocache("""
debug_overdue_count=get_table_nocache("""
select
due_date_id,
completed_date_id,
td_created_time,
td_modified_time,
fld_folder_name,
l_list_name,
td_title
Expand All @@ -228,18 +229,39 @@ def get_table_nocache(query):
and fld_folder_name not in ('🚀SOMEDAY lists','🛩Horizon of focus','💤on hold lists')
and l_list_name not like '%tickler note%'
and due_date_id is not null
""")
debug_today__count = debug_today__count[debug_today__count['due_date_id'] <= pd.to_datetime(datetime.datetime.now().date())]
st.dataframe(debug_today__count)
""").reset_index()
debug_overdue_count = debug_overdue_count[debug_overdue_count['due_date_id'] < pd.to_datetime(datetime.datetime.now().date())] if debug_overdue_count.shape[0] > 0 else None
st.dataframe(debug_overdue_count)
st.code(today_table_query)
st.code(today_table)
# st.code(today_table)
with col2:
st.metric(
label="tasks lined up",
value=today_count,
delta = f"{delta_today} than usual {today_avg} tasks",
delta_color="inverse",
)
with st.expander("query"):
debug_today_count=get_table_nocache("""
select
due_date_id,
td_created_time,
td_modified_time,
fld_folder_name,
l_list_name,
td_title
,* from obt where
completed_date_id is null
and l_is_active = '1'
and td_kind = 'TEXT'
and fld_folder_name not in ('🚀SOMEDAY lists','🛩Horizon of focus','💤on hold lists')
and l_list_name not like '%tickler note%'
and due_date_id is not null
""").reset_index()
debug_today_count = debug_today_count[debug_today_count['due_date_id'] == pd.to_datetime(datetime.datetime.now().date())]
st.dataframe(debug_today_count)
st.code(today_table_query)
# st.code(today_table)

with col3:
st.metric(
Expand Down

0 comments on commit 64e9ac3

Please sign in to comment.