unrealities / MTGA_Draft_17Lands

Magic: The Gathering Arena draft tool that utilizes 17Lands data
MIT License
26 stars 1 forks source link

[Bug]: App Uses Obsolete Datasets #29

Closed FiYir closed 1 month ago

FiYir commented 1 month ago

Describe the bug in detail

If you have two datasets—one using the new naming format (MKM_PremierDraft_All_Data) and the other using the old format (MKM_PremierDraft_Data)—the app always opts for the old one over the new. Essentially, if users have old datasets in their Sets folder, they won't be able to update the dataset unless they delete the old file.

This poses a problem for users who initially downloaded the dataset from the obsolete project and then transitioned to your fork. Since the Windows installer retains the same project location, those switching to your fork will still have all datasets from the old project.

Steps to reproduce this bug

  1. Download an MH3 premier draft dataset for user group All and a date range of 2019-1-1 to 2024-6-10. This is the dataset from before day 1.
  2. Open a stored draft log from an MH3 event.
  3. Open the Card Compare window.
  4. Enter the card name Ajani, Nacatl Pariah.
  5. Click on the card row to open the tooltip window.
  6. Confirm that the stats for the card are all zero.
  7. Open the Sets folder and rename file MH3_PremierDraft_All_Data to MH3_PremierDraft_Data
  8. Download an MH3 premier draft dataset for user group All and a date range of 2019-1-1 to today.
  9. Open a stored draft log from an MH3 event.
  10. Open the Card Compare window.
  11. Enter the card name Ajani, Nacatl Pariah.
  12. Click on the card row to open the tooltip window.
  13. Confirm that the stats for the card are all still zero.

Operating System

Windows

Operating System Version

Windows 11

Run Type

Windows Executable

Python Version

No response

Debug Log Details

No log errors

Possible Solution (optional)

The retrieve_data_sources method sorts the stored datasets by end date and then writes the entries into the data_sources dictionary. Because both the new and old datasets use the same dictionary key, and the method inserts datasets by date, the oldest dataset overwrites the latest one in the dictionary.

A straightforward solution would be to check if the key already exists in the dictionary and simply ignore duplicate entries. However, this approach has a drawback: if a user attempts to download a new dataset with an end date older than that of an existing old dataset, the old dataset will be prioritized.

Alternatively, another solution involves having the app disregard datasets from the old project, forcing users to re-download any datasets they may already possess. To implement this, adjustments would be made to the retrieve_local_set_list function by removing the elif code that supports old files.