removed bot logging messages
This commit is contained in:
15
database.py
15
database.py
@@ -8,6 +8,7 @@ load_dotenv()
|
||||
|
||||
pb = PocketBase(os.getenv('POCKETBASE_URL'))
|
||||
admin_data = pb.admins.auth_with_password(os.getenv('POCKETBASE_ADMIN_EMAIL'), os.getenv('POCKETBASE_ADMIN_PASSWORD'))
|
||||
show_debug_msg = False
|
||||
|
||||
def convert_datetime_to_pocketbase(date_time_str):
|
||||
"""
|
||||
@@ -18,7 +19,8 @@ def convert_datetime_to_pocketbase(date_time_str):
|
||||
return None
|
||||
|
||||
try:
|
||||
print(f"[DEBUG] Converting datetime: '{date_time_str}' (type: {type(date_time_str)})")
|
||||
if show_debug_msg:
|
||||
print(f"[DEBUG] Converting datetime: '{date_time_str}' (type: {type(date_time_str)})")
|
||||
|
||||
# Parse the input format: "DD-MM-YYYY HH:MM" or "DD-MM-YYYY (HH:MM)"
|
||||
date_time_str = date_time_str.replace("(", "").replace(")", "").strip()
|
||||
@@ -32,7 +34,8 @@ def convert_datetime_to_pocketbase(date_time_str):
|
||||
|
||||
# Convert to PocketBase local datetime format: YYYY-MM-DD HH:MM:SS
|
||||
pb_format = dt.strftime("%Y-%m-%d %H:%M:%S")
|
||||
print(f"[DEBUG] Converted to PocketBase format: '{pb_format}'")
|
||||
if show_debug_msg:
|
||||
print(f"[DEBUG] Converted to PocketBase format: '{pb_format}'")
|
||||
return pb_format
|
||||
except Exception as e:
|
||||
print(f"[ERROR] Error converting datetime '{date_time_str}': {e}")
|
||||
@@ -49,7 +52,7 @@ def upload_entry(data, entry_type='opportunity', url=None):
|
||||
entry_type: 'opportunity' or 'event'
|
||||
url: The source URL of the entry
|
||||
"""
|
||||
print(f"[DEBUG] Uploading {entry_type} entry. Data: {data}")
|
||||
print(f"[DEBUG] Uploading {entry_type} entry. Data: {data["title"]}")
|
||||
data = dict(data)
|
||||
|
||||
# Add URL to data if provided
|
||||
@@ -66,7 +69,8 @@ def upload_entry(data, entry_type='opportunity', url=None):
|
||||
data['datetime'] = convert_datetime_to_pocketbase(data['date_time'])
|
||||
# Remove the original field since PocketBase expects 'datetime'
|
||||
del data['date_time']
|
||||
print(f"[DEBUG] Event datetime: '{original_dt}' -> '{data['datetime']}'")
|
||||
if show_debug_msg:
|
||||
print(f"[DEBUG] Event datetime: '{original_dt}' -> '{data['datetime']}'")
|
||||
else:
|
||||
print(f"[WARNING] No 'date_time' field found in event data")
|
||||
|
||||
@@ -81,7 +85,8 @@ def upload_entry(data, entry_type='opportunity', url=None):
|
||||
original_deadline = data['deadline']
|
||||
# Convert deadline to PocketBase datetime format
|
||||
data['deadline'] = convert_datetime_to_pocketbase(data['deadline'])
|
||||
print(f"[DEBUG] Opportunity deadline: '{original_deadline}' -> '{data['deadline']}'")
|
||||
if show_debug_msg:
|
||||
print(f"[DEBUG] Opportunity deadline: '{original_deadline}' -> '{data['deadline']}'")
|
||||
else:
|
||||
print(f"[WARNING] No 'deadline' field found in opportunity data")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user