Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -75,12 +75,12 @@ def generate_main_accounts(updated_data=None):
|
|
75 |
save_processed_files(UPDATED_ASSIGNMENTS, PROCESSED_FOLDER)
|
76 |
return "Assignments updated successfully!", pd.DataFrame(updated_data)
|
77 |
|
78 |
-
#
|
79 |
-
|
80 |
-
|
|
|
81 |
|
82 |
# Ensure creators file has correct columns
|
83 |
-
creators_df = pd.read_excel(creators_file)
|
84 |
column_mapping = {
|
85 |
"Creator": "Creator",
|
86 |
"Total earnings": "Total earnings",
|
@@ -90,6 +90,10 @@ def generate_main_accounts(updated_data=None):
|
|
90 |
}
|
91 |
creators_df.rename(columns={k: v for k, v in column_mapping.items() if k in creators_df.columns}, inplace=True)
|
92 |
|
|
|
|
|
|
|
|
|
93 |
required_columns = ["Creator", "ActiveFans"]
|
94 |
missing_columns = [col for col in required_columns if col not in creators_df.columns]
|
95 |
if missing_columns:
|
@@ -97,6 +101,8 @@ def generate_main_accounts(updated_data=None):
|
|
97 |
|
98 |
# Save the processed creators file
|
99 |
creators_df.to_excel(os.path.join(PROCESSED_FOLDER, "creators_file.xlsx"), index=False)
|
|
|
|
|
100 |
save_processed_files(main_assignments, PROCESSED_FOLDER)
|
101 |
|
102 |
# Combine all shifts into a single DataFrame for preview
|
@@ -117,6 +123,7 @@ def generate_main_accounts(updated_data=None):
|
|
117 |
|
118 |
|
119 |
|
|
|
120 |
# Global variable to store updated assignments from the main account generation
|
121 |
UPDATED_ASSIGNMENTS = {}
|
122 |
|
|
|
75 |
save_processed_files(UPDATED_ASSIGNMENTS, PROCESSED_FOLDER)
|
76 |
return "Assignments updated successfully!", pd.DataFrame(updated_data)
|
77 |
|
78 |
+
# Debugging: Verify creators file before processing
|
79 |
+
print("DEBUG: Original Creators File Columns")
|
80 |
+
creators_df = pd.read_excel(creators_file)
|
81 |
+
print(creators_df.columns)
|
82 |
|
83 |
# Ensure creators file has correct columns
|
|
|
84 |
column_mapping = {
|
85 |
"Creator": "Creator",
|
86 |
"Total earnings": "Total earnings",
|
|
|
90 |
}
|
91 |
creators_df.rename(columns={k: v for k, v in column_mapping.items() if k in creators_df.columns}, inplace=True)
|
92 |
|
93 |
+
# Debugging: Verify creators file after renaming
|
94 |
+
print("DEBUG: Renamed Creators File Columns")
|
95 |
+
print(creators_df.columns)
|
96 |
+
|
97 |
required_columns = ["Creator", "ActiveFans"]
|
98 |
missing_columns = [col for col in required_columns if col not in creators_df.columns]
|
99 |
if missing_columns:
|
|
|
101 |
|
102 |
# Save the processed creators file
|
103 |
creators_df.to_excel(os.path.join(PROCESSED_FOLDER, "creators_file.xlsx"), index=False)
|
104 |
+
main_assignments = assign_main_accounts(creators_file, chatter_files)
|
105 |
+
UPDATED_ASSIGNMENTS = main_assignments
|
106 |
save_processed_files(main_assignments, PROCESSED_FOLDER)
|
107 |
|
108 |
# Combine all shifts into a single DataFrame for preview
|
|
|
123 |
|
124 |
|
125 |
|
126 |
+
|
127 |
# Global variable to store updated assignments from the main account generation
|
128 |
UPDATED_ASSIGNMENTS = {}
|
129 |
|