Fix version lookup

Checking regions was pretty superfluous anyway, since it only served to *potentially* speed up the lookup.
This commit is contained in:
yeah-its-gloria 2024-10-21 23:22:51 +02:00
parent 9c15eac1fd
commit dd79be0b48
No known key found for this signature in database
GPG Key ID: 3940AE4348411FD7

View File

@ -400,26 +400,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if not ((title_["TID"][-2:] == "XX" and title_["TID"][:-2] == tid[:-2]) or title_["TID"] == tid): if not ((title_["TID"][-2:] == "XX" and title_["TID"][:-2] == tid[:-2]) or title_["TID"] == tid):
continue continue
region = None
found_ver = False found_ver = False
if title_["TID"][-2:] == "XX": for region in title_["Versions"]:
global regions for db_version in title_["Versions"][region]:
for region_ in regions: if db_version == version:
for code in regions[region_]: found_ver = True
if code == tid[:-2]: break
region = region_
break
if region is None:
QMessageBox.critical(self, app.translate("MainWindow", "Script Failure"), app.translate("MainWindow", "Title #%n belongs to an unknown region.", "", index+1), buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.Ok)
return
else:
region = "World"
for db_version in title_["Versions"][region]:
if db_version == version:
found_ver = True
break
if not found_ver: if not found_ver:
QMessageBox.critical(self, app.translate("MainWindow", "Script Failure"), app.translate("MainWindow", "The version for title #%n could not be discovered in the database.", "", index+1), buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.Ok) QMessageBox.critical(self, app.translate("MainWindow", "Script Failure"), app.translate("MainWindow", "The version for title #%n could not be discovered in the database.", "", index+1), buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.Ok)