fix: new detections are not shown: disable caching get_data()
This commit is contained in:
@@ -57,15 +57,13 @@ def get_connection(path: str):
|
|||||||
return sqlite3.connect(path, check_same_thread=False)
|
return sqlite3.connect(path, check_same_thread=False)
|
||||||
|
|
||||||
|
|
||||||
@st.cache_resource()
|
|
||||||
def get_data(_conn: Connection):
|
def get_data(_conn: Connection):
|
||||||
df1 = pd.read_sql("SELECT * FROM detections", con=conn)
|
df1 = pd.read_sql("SELECT * FROM detections", con=conn)
|
||||||
return df1
|
return df1
|
||||||
|
|
||||||
|
|
||||||
conn = get_connection(URI_SQLITE_DB)
|
conn = get_connection(URI_SQLITE_DB)
|
||||||
df = get_data(conn)
|
df2 = get_data(conn)
|
||||||
df2 = df.copy()
|
|
||||||
df2['DateTime'] = pd.to_datetime(df2['Date'] + " " + df2['Time'])
|
df2['DateTime'] = pd.to_datetime(df2['Date'] + " " + df2['Time'])
|
||||||
df2 = df2.set_index('DateTime')
|
df2 = df2.set_index('DateTime')
|
||||||
|
|
||||||
@@ -184,8 +182,8 @@ font_size = 15
|
|||||||
|
|
||||||
|
|
||||||
def sunrise_sunset_scatter(num_days_to_display):
|
def sunrise_sunset_scatter(num_days_to_display):
|
||||||
latitude = df['Lat'][0]
|
latitude = df2['Lat'][0]
|
||||||
longitude = df['Lon'][0]
|
longitude = df2['Lon'][0]
|
||||||
|
|
||||||
sun = Sun(latitude, longitude)
|
sun = Sun(latitude, longitude)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user