Skip to content

Commit

Permalink
feat: updated version to current timestamp in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sujanadh committed Sep 9, 2024
1 parent 55a09fe commit b98b419
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions osm_fieldwork/update_form.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
from io import BytesIO

import pandas as pd
Expand Down Expand Up @@ -102,6 +103,14 @@ def update_xls_form(custom_form: BytesIO) -> BytesIO:
# Append or overwrite the existing entities sheet
if "entities" in mandatory_sheets:
custom_sheets["entities"] = mandatory_sheets["entities"]

if "settings" in mandatory_sheets:
custom_sheets["settings"] = mandatory_sheets["settings"]
current_timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')

# Set the 'version' column to the current timestamp (if 'version' column exists in 'settings')
if "version" in custom_sheets["settings"].columns:
custom_sheets["settings"].loc[:, "version"] = current_timestamp

output = BytesIO()
with pd.ExcelWriter(output, engine="openpyxl") as writer:
Expand Down

0 comments on commit b98b419

Please sign in to comment.