saq1b commited on
Commit
b947603
·
verified ·
1 Parent(s): 0aa1940

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -0
main.py CHANGED
@@ -270,6 +270,7 @@ async def get_roblox_avatar_url(session: aiohttp.ClientSession, user_id: int):
270
  def process_sheet_data(values): # For Value Categories
271
  if not values: return []
272
  processed_data = []
 
273
  for row_idx, row in enumerate(values): # Start counting from sheet row 6 (index 0 here)
274
  if not row or not any(str(cell).strip() for cell in row if cell is not None): continue
275
  # Skip header-like rows (e.g., "LEVEL 1 | HYPERCHROMES" in column F/index 4)
@@ -302,6 +303,7 @@ def process_sheet_data(values): # For Value Categories
302
  'marketValue': format_currency(market_value_raw),
303
  'demand': clean_string(demand, 'N/A'),
304
  'notes': clean_string(notes, '')
 
305
  }
306
  processed_data.append(processed_item)
307
  return processed_data
@@ -732,6 +734,11 @@ async def update_cache_periodically():
732
  category_changes_for_api.append(change_info)
733
  change_detected_for_webhook = True
734
  change_info_webhook = change_info # Store last change for potential webhook
 
 
 
 
 
735
 
736
  # Prepare webhook only if a change was found AND cache was ready
737
  if change_detected_for_webhook and cache["is_ready"] and VALUE_WEBHOOK_URL:
 
270
  def process_sheet_data(values): # For Value Categories
271
  if not values: return []
272
  processed_data = []
273
+
274
  for row_idx, row in enumerate(values): # Start counting from sheet row 6 (index 0 here)
275
  if not row or not any(str(cell).strip() for cell in row if cell is not None): continue
276
  # Skip header-like rows (e.g., "LEVEL 1 | HYPERCHROMES" in column F/index 4)
 
303
  'marketValue': format_currency(market_value_raw),
304
  'demand': clean_string(demand, 'N/A'),
305
  'notes': clean_string(notes, '')
306
+ # Remove lastUpdated field - will only be set when an update is detected
307
  }
308
  processed_data.append(processed_item)
309
  return processed_data
 
734
  category_changes_for_api.append(change_info)
735
  change_detected_for_webhook = True
736
  change_info_webhook = change_info # Store last change for potential webhook
737
+ # Add lastUpdated field to new_item when changes detected
738
+ new_item['lastUpdated'] = timestamp_iso
739
+ else:
740
+ # This is a new item, add lastUpdated field
741
+ new_item['lastUpdated'] = timestamp_iso
742
 
743
  # Prepare webhook only if a change was found AND cache was ready
744
  if change_detected_for_webhook and cache["is_ready"] and VALUE_WEBHOOK_URL: