KirkMcDonald / kirkmcdonald.github.io

Simple web-based calculator for the game Factorio.
Apache License 2.0
540 stars 148 forks source link

Handle data dump upgrades more gracefully #111

Closed KirkMcDonald closed 5 years ago

KirkMcDonald commented 5 years ago

Currently, if a URL includes a data= parameter that indicates a dataset that does not exist in the known list of datasets, the calculator will shrug and fall back on the default dataset. There are circumstances in which this is not desirable.

For example, if the URL has data=bobs-0-16-37, and I were to upgrade the Bob's dataset to 0.16.51, any existing URLs for Bob's would become invalid, falling back on the current default dataset (which should always be for the stable vanilla version), and causing all sorts of havoc.

When an exact match for the dataset can not be found, the calculator should be capable of falling back on a reasonably similar known dataset: bobs should match to bobs, major versions should match to major versions, and so forth.

KirkMcDonald commented 5 years ago

b67a55cf9bd8887879255c1b21225525941f0c6a adds a workaround for explicitly mapping old dataset tags to new ones. I may revisit this with a generalized solution later, but this issue was blocking other changes, so I judged an expedient solution was better than no solution.