From e722f16aa9bedbc064d1adf3628736157f8f57d8 Mon Sep 17 00:00:00 2001
From: kienle <kienle@passcal.nmt.edu>
Date: Fri, 24 Jan 2025 10:49:56 -0700
Subject: [PATCH] Revert "FIx reset row to backup db not working"

This reverts commit 3606016b51fdc4e13e867209310d8cbb3a8e6435.
---
 sohstationviewer/view/db_config/channel_dialog.py   | 2 +-
 sohstationviewer/view/db_config/db_config_dialog.py | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sohstationviewer/view/db_config/channel_dialog.py b/sohstationviewer/view/db_config/channel_dialog.py
index 6a4f7734..7a844fa7 100755
--- a/sohstationviewer/view/db_config/channel_dialog.py
+++ b/sohstationviewer/view/db_config/channel_dialog.py
@@ -168,7 +168,7 @@ class ChannelDialog(UiDBInfoDialog):
             str(row_content[3]))
         self.data_table_widget.cellWidget(row_idx, 5).setText(row_content[4])
         self.data_table_widget.cellWidget(row_idx, 6).setValue(row_content[5])
-        self.data_table_widget.cellWidget(row_idx, 7).setChecked(row_content[6])
+        self.data_table_widget.cellWidget(row_idx, 7).set_checked(row_content[6])
 
     def set_row_widgets(self, row_idx, fk=False):
         """
diff --git a/sohstationviewer/view/db_config/db_config_dialog.py b/sohstationviewer/view/db_config/db_config_dialog.py
index 22ebf089..32aedbdc 100755
--- a/sohstationviewer/view/db_config/db_config_dialog.py
+++ b/sohstationviewer/view/db_config/db_config_dialog.py
@@ -635,6 +635,10 @@ class UiDBInfoDialog(OneWindowAtATimeDialog):
             # Primary key is always the first item in a row
             backup_rows = [r for r in self.backup_database_rows
                            if r[0] == curr_row[0]]
+            if self.need_data_type_choice:
+                # data type is one of primary keys
+                backup_rows = [r for r in backup_rows
+                               if r[-1] == curr_row[-1]]
             if backup_rows:
                 # reset function available when there's backup row
                 backup_row = backup_rows[0]
-- 
GitLab