DontPlanToEnd commited on
Commit
a0b87ec
Β·
verified Β·
1 Parent(s): 7872803

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -1324,6 +1324,7 @@ def sync_presets_and_checklists(*selector_values):
1324
  elif selected_preset == "Writing":
1325
  checklist_outputs["Writing"] = list(PRESET_COLUMNS["Writing"].keys())
1326
  checklist_outputs["Intelligence"] = ["NatInt πŸ’‘"]
 
1327
  elif selected_preset in checklist_outputs:
1328
  checklist_outputs[selected_preset] = list(PRESET_COLUMNS[selected_preset].keys())
1329
 
@@ -1403,9 +1404,10 @@ def update_columns_and_sort(uncensored_cols, intelligence_cols, writing_cols, po
1403
 
1404
  if active_preset == 'Writing':
1405
  natint_col_def = next((col for col in final_defs if col.get('field') == 'NatInt πŸ’‘'), None)
 
1406
 
1407
  if natint_col_def:
1408
- temp_defs = [col for col in final_defs if col.get('field') != 'NatInt πŸ’‘']
1409
  try:
1410
  insert_index = next(i for i, col in enumerate(temp_defs) if col.get('field') == 'Writing ✍️') + 1
1411
  temp_defs.insert(insert_index, natint_col_def)
@@ -1413,6 +1415,20 @@ def update_columns_and_sort(uncensored_cols, intelligence_cols, writing_cols, po
1413
  except StopIteration:
1414
  pass
1415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1416
  # --- Logic for adding optimal values via CSS classes (unchanged and correct) ---
1417
  WRITING_OPTIMAL_CLASSES = {
1418
  "avg_length_error_pct": "header-optimal-len-err",
@@ -1449,7 +1465,7 @@ def update_columns_and_sort(uncensored_cols, intelligence_cols, writing_cols, po
1449
  elif active_preset == 'Intelligence':
1450
  border_cols = {"NatInt πŸ’‘"}
1451
  elif active_preset == 'Writing':
1452
- border_cols = {"Writing ✍️", "NatInt πŸ’‘"}
1453
  else:
1454
  main_score_columns = ["UGI πŸ†", "W/10 πŸ‘", "NatInt πŸ’‘", "Writing ✍️", "Political Lean πŸ“‹"]
1455
  for col_def in final_defs:
 
1324
  elif selected_preset == "Writing":
1325
  checklist_outputs["Writing"] = list(PRESET_COLUMNS["Writing"].keys())
1326
  checklist_outputs["Intelligence"] = ["NatInt πŸ’‘"]
1327
+ checklist_outputs["Uncensored"] = ["W/10 πŸ‘"]
1328
  elif selected_preset in checklist_outputs:
1329
  checklist_outputs[selected_preset] = list(PRESET_COLUMNS[selected_preset].keys())
1330
 
 
1404
 
1405
  if active_preset == 'Writing':
1406
  natint_col_def = next((col for col in final_defs if col.get('field') == 'NatInt πŸ’‘'), None)
1407
+ w10_col_def = next((col for col in final_defs if col.get('field') == 'W/10 πŸ‘'), None)
1408
 
1409
  if natint_col_def:
1410
+ temp_defs =[col for col in final_defs if col.get('field') != 'NatInt πŸ’‘']
1411
  try:
1412
  insert_index = next(i for i, col in enumerate(temp_defs) if col.get('field') == 'Writing ✍️') + 1
1413
  temp_defs.insert(insert_index, natint_col_def)
 
1415
  except StopIteration:
1416
  pass
1417
 
1418
+ w10_cols_to_move =['W/10 πŸ‘', 'W/10-Direct', 'W/10-Adherence']
1419
+ w10_col_defs =[col for col in final_defs if col.get('field') in w10_cols_to_move]
1420
+
1421
+ if w10_col_defs:
1422
+ temp_defs =[col for col in final_defs if col.get('field') not in w10_cols_to_move]
1423
+ try:
1424
+ insert_index = next(i for i, col in enumerate(temp_defs) if col.get('field') == 'avg_dark_score') + 1
1425
+ w10_col_defs.sort(key=lambda c: w10_cols_to_move.index(c.get('field')))
1426
+ for c in reversed(w10_col_defs):
1427
+ temp_defs.insert(insert_index, c)
1428
+ final_defs = temp_defs
1429
+ except StopIteration:
1430
+ pass
1431
+
1432
  # --- Logic for adding optimal values via CSS classes (unchanged and correct) ---
1433
  WRITING_OPTIMAL_CLASSES = {
1434
  "avg_length_error_pct": "header-optimal-len-err",
 
1465
  elif active_preset == 'Intelligence':
1466
  border_cols = {"NatInt πŸ’‘"}
1467
  elif active_preset == 'Writing':
1468
+ border_cols = {"Writing ✍️", "NatInt πŸ’‘", "W/10 πŸ‘"}
1469
  else:
1470
  main_score_columns = ["UGI πŸ†", "W/10 πŸ‘", "NatInt πŸ’‘", "Writing ✍️", "Political Lean πŸ“‹"]
1471
  for col_def in final_defs: