QIDNLF commited on
Commit
043ef6c
·
verified ·
1 Parent(s): 1c3ef01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -536,15 +536,19 @@ def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, com
536
  has_b = not pd.isna(row.get('base_idx')) and row.get('base_idx') != float('inf')
537
  has_c = not pd.isna(row.get('comp_idx')) and row.get('comp_idx') != float('inf')
538
 
539
- if mapped_only and not (has_b and has_c):
540
- continue
541
-
542
  for c in rename_b.values(): row_dict[c] = str(row[c]) if has_b and not pd.isna(row[c]) else ""
543
  for c in rename_c.values(): row_dict[c] = str(row[c]) if has_c and not pd.isna(row[c]) else ""
544
-
 
 
 
 
 
 
 
545
  if has_b and has_c:
546
  for orig_col in rename_b.keys():
547
- if 'description' in orig_col.lower() and rename_c.get(orig_col) in row_dict:
548
  b_v, c_v = row_dict[rename_b[orig_col]], row_dict[rename_c[orig_col]]
549
  if b_v and c_v and "<img" not in b_v and "<img" not in c_v and b_v != c_v:
550
  row_dict[rename_b[orig_col]], row_dict[rename_c[orig_col]] = generate_html_diff(b_v, c_v)
@@ -552,6 +556,9 @@ def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, com
552
 
553
  final_df = combine_code_desc(pd.DataFrame(result_rows))
554
 
 
 
 
555
  if diff_only:
556
  mask = final_df.astype(str).apply(lambda col: col.str.contains('color:#ff4d4f|color:#2ecc71', case=False, regex=True)).any(axis=1)
557
  final_df = final_df[mask]
 
536
  has_b = not pd.isna(row.get('base_idx')) and row.get('base_idx') != float('inf')
537
  has_c = not pd.isna(row.get('comp_idx')) and row.get('comp_idx') != float('inf')
538
 
 
 
 
539
  for c in rename_b.values(): row_dict[c] = str(row[c]) if has_b and not pd.isna(row[c]) else ""
540
  for c in rename_c.values(): row_dict[c] = str(row[c]) if has_c and not pd.isna(row[c]) else ""
541
+
542
+ if mapped_only:
543
+ b_has_val = any(str(row_dict[c]).strip() not in ["", "nan", "None", "&nbsp;"] for c in rename_b.values())
544
+ c_has_val = any(str(row_dict[c]).strip() not in ["", "nan", "None", "&nbsp;"] for c in rename_c.values())
545
+
546
+ if not (b_has_val and c_has_val):
547
+ continue
548
+
549
  if has_b and has_c:
550
  for orig_col in rename_b.keys():
551
+ if ('description' in orig_col.lower() or '내용' in orig_col) and rename_c.get(orig_col) in row_dict:
552
  b_v, c_v = row_dict[rename_b[orig_col]], row_dict[rename_c[orig_col]]
553
  if b_v and c_v and "<img" not in b_v and "<img" not in c_v and b_v != c_v:
554
  row_dict[rename_b[orig_col]], row_dict[rename_c[orig_col]] = generate_html_diff(b_v, c_v)
 
556
 
557
  final_df = combine_code_desc(pd.DataFrame(result_rows))
558
 
559
+ if final_df.empty:
560
+ return pd.DataFrame({"Info": ["💡 조건에 맞는 데이터가 없습니다."]})
561
+
562
  if diff_only:
563
  mask = final_df.astype(str).apply(lambda col: col.str.contains('color:#ff4d4f|color:#2ecc71', case=False, regex=True)).any(axis=1)
564
  final_df = final_df[mask]