Module talk:Armor

Compatibility
Summary of the issues encountered: The fixes for 1 and 3 seem fine to me, the workaround for 2 feels rather crude to me. For 5, the solution could be to store the upgrade data for TotK on a separate page (maybe a  page?) but this would need a 2nd crude workaround. Another would be to modify the restriction on StoreAs, perhaps changing it from one table to one table per game, if that's possible? Third would be to rework how the module stores and retrieves data so that BotW data and TotK data are separate in cargo but both handled by this module. However, until the upgrade data is complete or a solution for 4 is found, the optimal solution to 5 seems to be a moot point. 15:31, 2 June 2023 (UTC)
 * 1) module has a game parameter but only actually supports BotW (previous fix)
 * 2) module only allows data from Armor and Armor Upgrade
 * 3) *TotK Armor is stored on Armor in Tears of the Kingdom (previous workaround)
 * 4) while using to retrieve upgrade information, the Cargo query doesn't check which game the data is from
 * 5) * would return BotW upgrade data if available (previous fix, same edit as in previous point)
 * 6) Storing to cargo has weird behaviour if Sell Price column has an empty value
 * 7) *Storage of that row fails and any edit, even null edits, cause duplication of data in the Cargo table
 * 8) **Consequently, the previous fixes were removed while identifying this issue
 * 9) Upgrade data for TotK's Armor is not being stored due to the restriction on Data Table's StoreAs parameter, the module's storeUpgrade function automatically sets this as Armor


 * Thanks for looking into this! Here are my first impressions based on the little time I've had to look into this so far.


 * Solutions to #1 and #3 seem fine to me as well.


 * For #2, one solution could be to allow data to be stored on any mainspace (or Data) page, rather than restricting it to specific articles. If there was a reason why I didn't go that route in the first place, I don't remember it. It may have just been an oversight on my part. The main thing is to prevent data from leaking into the Cargo tables via user sandboxes and the like.


 * For #4, I can't think of a root cause off the top of my head. If I had more time, the first thing I would try would be to log the object created on line 217 of the current version (the data being passed to the /Store template via the  parameter of the expandTemplate function) and see if there might be anything wrong with the data being passed to Cargo.
 * I can't recall ever having seen Cargo tables behave this way before. The closest thing I can think of was that one time it refused to store any rows at all. That turned out to be an issue of some data not matching their column type—the template was trying to put strings into an integer column or something like that. It was silently failing the first invalid #cargo_store call and every subsequent one.


 * For #5, I'm not sure I grasp the problem. Is it that the Armor Upgrade page is trying to store two data tables with the same name, and it's not working because storeAs has to be unique per page?
 * I'll try to find more time to look at the code and understand the problem better. PhantomCaleb (talk) 23:36, 7 June 2023 (UTC)
 * For #4, it might be the same underlying issue as the one you described where a non-integer is being put into an integer column and it silently fails when storing that row. The duplication of the data before the failed store wasn't seen in the other case because it failed to store any rows. But I don't know why a blank cell is being read as a non-integer or how to fix that.
 * For #5, yes, this is what I thought was the issue but while writing this reply I realized that I was misinterpreting a number of things and came to a wildly wrong conclusion. Issue #5 didn't actually exist, it was just issue #4 happening at the first row because the first Sell Price was missing. I can confirm this as after this edit, the cargo table now stores the first six rows of the TotK upgrade data and it seems to be failing on the 7th as the defense, another integer, is missing (those six rows are also being duplicated in cargo after editing). 10:30, 8 June 2023 (UTC)
 * Hi, I made some changes to the module in order to fix some display issues I was encountering and I think I may have assisted you as well. Lmk if my edits have solved any of the problems you can across. Sylphoid (talk) 15:23, 20 June 2023 (UTC)
 * Hi, your edits helped with problems #1 and #3, which had been previously solved but those solutions were undone because of the data duplication problem in #4. However, it seemed that the data duplication stopped occurring about a week ago but I had no idea why so I waited before adding this revised edit.
 * @PhantomCaleb, I now see the issue with using  the way I did in that edit so I also tried this, which is similar to what you've used in other modules. That unfortunately seemed to re-introduce the data duplication and had to be undone. So, at the moment, this module is not protected from user sandboxes.
 * Also, I tried to fix this but when storing the BotW upgrades for the Flamebreker Helm, Flamebreaker Armor and Flamebreaker Boots,  seems to return the TotK name for the Armor Set instead of the BotW name so the upgrades have the Armor Set stored as Flame-Resistant Equipment in cargo instead of Fireproof Armor.  17:15, 20 June 2023 (UTC)

Armor Sets
Related to the last thing I mentioned in the previous topic, the module can't seem to handle one Armor Set having multiple names across BotW and TotK. This can be seen on the recently updated pages for Armor Sets such as the Of Time Set, where the BotW data only has the base Armor data and none of the upgrade data (Switching to  has the opposite effect of displaying the upgrade data but not the base Armor data). Also, I think this is a separate issue related to Armor Sets but it appears that when the set name matches the name of one of its pieces, like the Fierce Deity Armor (Set) (Fierce Deity Armor in TotK) or the Rubber Set (Rubber Armor in BotW), the data for the singular piece is displayed instead of the data for the whole set. 09:17, 26 October 2023 (UTC)


 * I believe this edit fixes the first issue.
 * The second issue can be worked around by specifying the set name used in the Armor table (example). Not ideal but I can't think of a better solution at the moment. PhantomCaleb (talk) 13:47, 26 October 2023 (UTC)