Fix minimarket form data handling and Excel template integration

- Ensured minimarket_store_type section is properly generated in config.json
- Form now correctly saves and processes minimarket data when selected
- Excel template integration working for all store types including minimarket

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andrei
2025-09-24 11:55:00 +00:00
parent 6b25a7ddad
commit ee0bb76f22
5 changed files with 77 additions and 28 deletions

View File

@@ -1,37 +1,47 @@
{
"user_data": {
"first_name": "Denisa",
"last_name": "Cirsteas",
"company_name": "footprints",
"email": "test@test.ro",
"phone": "1231231231",
"store_name": "TEST9",
"country": "Romania",
"starting_date": "2026-01-01",
"duration": 36,
"first_name": "ggggfd",
"last_name": "fdgd",
"company_name": "hlhl",
"email": "kjhkjhk",
"phone": "hkjhkj",
"store_name": "asc",
"country": "hlkhkj",
"starting_date": "2025-10-01",
"duration": 24,
"store_types": [
"Convenience",
"Supermarket"
"Minimarket"
],
"open_days_per_month": 30,
"convenience_store_type": {
"stores_number": 4000,
"monthly_transactions": 40404040,
"stores_number": 100,
"monthly_transactions": 101010,
"has_digital_screens": true,
"screen_count": 2,
"screen_count": 3,
"screen_percentage": 100,
"has_in_store_radio": true,
"radio_percentage": 100,
"open_days_per_month": 30
},
"supermarket_store_type": {
"stores_number": 200,
"monthly_transactions": 20202020,
"minimarket_store_type": {
"stores_number": 1000,
"monthly_transactions": 123123123,
"has_digital_screens": true,
"screen_count": 4,
"screen_percentage": 100,
"screen_count": 2,
"screen_percentage": 1000,
"has_in_store_radio": true,
"radio_percentage": 100,
"radio_percentage": 1000,
"open_days_per_month": 30
},
"supermarket_store_type": {
"stores_number": 0,
"monthly_transactions": 0,
"has_digital_screens": false,
"screen_count": 0,
"screen_percentage": 0,
"has_in_store_radio": false,
"radio_percentage": 0,
"open_days_per_month": 30
},
"hypermarket_store_type": {
@@ -45,19 +55,27 @@
"open_days_per_month": 30
},
"on_site_channels": [
"Website"
"Website",
"Mobile App"
],
"website_visitors": 1001001,
"app_users": 0,
"website_visitors": 121212,
"app_users": 232323,
"loyalty_users": 0,
"off_site_channels": [
"Email"
"Facebook Business",
"Google Business Profile"
],
"facebook_followers": 0,
"facebook_followers": 123123,
"instagram_followers": 0,
"google_views": 0,
"email_subscribers": 100000,
"google_views": 123123,
"email_subscribers": 0,
"sms_users": 0,
"whatsapp_contacts": 0
"whatsapp_contacts": 0,
"potential_reach_in_store": 0,
"unique_impressions_in_store": 0,
"potential_reach_on_site": 0,
"unique_impressions_on_site": 0,
"potential_reach_off_site": 0,
"unique_impressions_off_site": 0
}
}

View File

@@ -46,6 +46,17 @@ async function updateConfig(formData) {
open_days_per_month: parseInt(formData.openDays) || 0
},
minimarket_store_type: {
stores_number: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_stores) || 0 : 0,
monthly_transactions: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_transactions) || 0 : 0,
has_digital_screens: isStoreTypeSelected(formData, 'Minimarket') ? formData.minimarket_screens === "Yes" : false,
screen_count: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_screen_count) || 0 : 0,
screen_percentage: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_screen_percentage) || 0 : 0,
has_in_store_radio: isStoreTypeSelected(formData, 'Minimarket') ? formData.minimarket_radio === "Yes" : false,
radio_percentage: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_radio_percentage) || 0 : 0,
open_days_per_month: parseInt(formData.openDays) || 0
},
supermarket_store_type: {
stores_number: isStoreTypeSelected(formData, 'Supermarket') ? parseInt(formData.supermarket_stores) || 0 : 0,
monthly_transactions: isStoreTypeSelected(formData, 'Supermarket') ? parseInt(formData.supermarket_transactions) || 0 : 0,

Binary file not shown.

View File

@@ -120,6 +120,11 @@ def update_excel_variables(excel_path):
except Exception as e:
print(f"Error updating cell {cell_ref}: {e}")
# Force formula recalculation before saving
print("Forcing formula recalculation...")
wb.calculation.calcMode = 'auto'
wb.calculation.fullCalcOnLoad = True
# Save the workbook with variables updated
print("Saving workbook with updated variables...")
wb.save(excel_path)
@@ -203,6 +208,11 @@ def update_excel_variables(excel_path):
except Exception as e:
print(f"Error extracting year from sheet name '{sheet_name}': {e}")
# Ensure formulas are marked for recalculation before final save
print("Ensuring formulas are marked for recalculation...")
wb.calculation.calcMode = 'auto'
wb.calculation.fullCalcOnLoad = True
# Save the workbook with updated variables and hidden sheets
print("Saving workbook with all updates...")
wb.save(excel_path)

View File

@@ -152,6 +152,11 @@ def update_excel_variables(excel_path):
except Exception as e:
print(f"Error updating cell {cell_ref}: {e}")
# Force formula recalculation before saving
print("Forcing formula recalculation...")
wb.calculation.calcMode = 'auto'
wb.calculation.fullCalcOnLoad = True
# Save the workbook with variables updated
print("Saving workbook with updated variables...")
wb.save(excel_path)
@@ -398,6 +403,11 @@ def update_excel_variables(excel_path):
except Exception as e:
print(f"Error extracting year from sheet name '{sheet_name}': {e}")
# Ensure formulas are marked for recalculation before final save
print("Ensuring formulas are marked for recalculation...")
wb.calculation.calcMode = 'auto'
wb.calculation.fullCalcOnLoad = True
# Save the workbook with updated variables and hidden sheets
print("Saving workbook with all updates...")
wb.save(excel_path)