Major JQL bugfixes
This commit is contained in:
@@ -39,6 +39,7 @@ from app.workers import (
|
||||
load_orders_by_view,
|
||||
get_dashboard_stats,
|
||||
mark_shipstation_sent,
|
||||
reset_local_database,
|
||||
)
|
||||
|
||||
|
||||
@@ -115,6 +116,11 @@ class MainWindow(QMainWindow):
|
||||
refresh_action.triggered.connect(self._refresh_everything)
|
||||
toolbar.addAction(refresh_action)
|
||||
|
||||
reset_action = QAction("Reset Local Database", self)
|
||||
reset_action.setToolTip("Wipes the local cache - re-import from JIRA afterward")
|
||||
reset_action.triggered.connect(self._on_reset_database_clicked)
|
||||
toolbar.addAction(reset_action)
|
||||
|
||||
self.status_bar = QStatusBar()
|
||||
self.setStatusBar(self.status_bar)
|
||||
self.status_label = QLabel("Ready.")
|
||||
@@ -333,6 +339,27 @@ class MainWindow(QMainWindow):
|
||||
"Upload this into ShipStation's Import Orders wizard.",
|
||||
)
|
||||
|
||||
def _on_reset_database_clicked(self) -> None:
|
||||
confirm = QMessageBox.warning(
|
||||
self,
|
||||
"Reset Local Database",
|
||||
"This clears every locally cached order (JIRA is still the real source of "
|
||||
"truth, so nothing there is affected). You'll need to click Import from JIRA "
|
||||
"afterward to repopulate, and Pull Tracking Numbers again if you rely on "
|
||||
"today's already-pulled tracking data.\n\n"
|
||||
"Continue?",
|
||||
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
|
||||
QMessageBox.StandardButton.No,
|
||||
)
|
||||
if confirm != QMessageBox.StandardButton.Yes:
|
||||
return
|
||||
|
||||
count = reset_local_database()
|
||||
self._refresh_everything()
|
||||
self.status_label.setText(
|
||||
f"Local database reset - {count} order(s) cleared. Run Import from JIRA to repopulate."
|
||||
)
|
||||
|
||||
def _refresh_everything(self) -> None:
|
||||
active_orders, cancelled_orders, done_orders = load_orders_by_view()
|
||||
self.orders_table.set_orders(active_orders)
|
||||
|
||||
Reference in New Issue
Block a user