Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,10 +49,18 @@ def generate_main_accounts():
|
|
| 49 |
creators_file, chatter_files
|
| 50 |
)
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
# Save updated files
|
| 53 |
for idx, chatter_df in enumerate(updated_chatter_files):
|
| 54 |
chatter_df.to_excel(
|
| 55 |
-
os.path.join(PROCESSED_FOLDER, f"Updated_{[
|
| 56 |
index=False
|
| 57 |
)
|
| 58 |
processed_creator_file.to_excel(
|
|
@@ -63,8 +71,11 @@ def generate_main_accounts():
|
|
| 63 |
except Exception as e:
|
| 64 |
return f"Error during main account generation: {e}", None, None
|
| 65 |
|
|
|
|
| 66 |
def update_assignments(assignments_df, creators_df):
|
| 67 |
try:
|
|
|
|
|
|
|
| 68 |
shifts = ["Overnight", "Day", "Prime"]
|
| 69 |
for shift in shifts:
|
| 70 |
shift_data = assignments_df[assignments_df["Shift"] == shift]
|
|
@@ -78,6 +89,7 @@ def update_assignments(assignments_df, creators_df):
|
|
| 78 |
except Exception as e:
|
| 79 |
return f"Error updating assignments: {e}"
|
| 80 |
|
|
|
|
| 81 |
def generate_full_schedule():
|
| 82 |
try:
|
| 83 |
chatter_files = [
|
|
|
|
| 49 |
creators_file, chatter_files
|
| 50 |
)
|
| 51 |
|
| 52 |
+
# Add the `Shift` column to the combined assignments
|
| 53 |
+
shifts = ["Overnight", "Day", "Prime"]
|
| 54 |
+
for idx, chatter_df in enumerate(updated_chatter_files):
|
| 55 |
+
chatter_df["Shift"] = shifts[idx]
|
| 56 |
+
updated_chatter_files[idx] = chatter_df
|
| 57 |
+
|
| 58 |
+
combined_assignments = pd.concat(updated_chatter_files)
|
| 59 |
+
|
| 60 |
# Save updated files
|
| 61 |
for idx, chatter_df in enumerate(updated_chatter_files):
|
| 62 |
chatter_df.to_excel(
|
| 63 |
+
os.path.join(PROCESSED_FOLDER, f"Updated_{shifts[idx].lower()}_file.xlsx"),
|
| 64 |
index=False
|
| 65 |
)
|
| 66 |
processed_creator_file.to_excel(
|
|
|
|
| 71 |
except Exception as e:
|
| 72 |
return f"Error during main account generation: {e}", None, None
|
| 73 |
|
| 74 |
+
|
| 75 |
def update_assignments(assignments_df, creators_df):
|
| 76 |
try:
|
| 77 |
+
print("DEBUG: Assignments DataFrame Columns:", assignments_df.columns)
|
| 78 |
+
|
| 79 |
shifts = ["Overnight", "Day", "Prime"]
|
| 80 |
for shift in shifts:
|
| 81 |
shift_data = assignments_df[assignments_df["Shift"] == shift]
|
|
|
|
| 89 |
except Exception as e:
|
| 90 |
return f"Error updating assignments: {e}"
|
| 91 |
|
| 92 |
+
|
| 93 |
def generate_full_schedule():
|
| 94 |
try:
|
| 95 |
chatter_files = [
|