Return an empty html file of heatmap_days_by_sensor when there are no records for any sensors.

pull/95/head
Meng Li 2020-08-12 16:26:11 -04:00
parent 1b4ad9c986
commit 5c25002507
1 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,11 @@ for sensor_path in snakemake.input["sensors"]:
row_count_sensors.index = pd.to_datetime(row_count_sensors.index)
row_count_sensors = row_count_sensors.join(phone_valid_sensed_days[["valid_sensed_hours"]], how="outer")
if row_count_sensors.empty:
empty_html = open(snakemake.output[0], "w")
empty_html.write("There are no records of sensors in database.")
empty_html.close()
# set date_idx based on the first date
reference_date = row_count_sensors.index.min()
last_date = row_count_sensors.index.max()