Module talk:Arbcom election banner

Latest comment: 7 months ago by Mr. Stradivarius in topic Year

Year edit

@Xaosflux: I note that Special:Diff/1042160676, updating the year in the name of the category for voter guides from 2020 to 2021, has made the previous years' ACE templates also now point to Category:Wikipedia Arbitration Committee Elections 2021 voter guides. More generally, I wonder, is there a reason that year is always the current year, rather than being taken as a parameter so that the ACE templates wouldn't need to specify so many link targets?2d37 (talk) 22:49, 3 September 2021 (UTC)Reply

@2d37: because no one built and implemented that parameter - feel free to mock up a change if you would like, getting ready for this year is more important that making old years work for me right now though. — xaosflux Talk 23:08, 3 September 2021 (UTC)Reply
@Xaosflux: Changes are in Module:Arbcom election banner/sandbox (and Module:Arbcom election banner/sandbox/doc) for review when there's time (perhaps after the election). I addressed both sentences of my original comment, which may constitute doing too much at once (although I hope the edit history is broken into small enough 'commits' for easy review). I've checked that the existing uses of the module appear to continue to work with the sandbox version, with no changes needed to the existing uses. —2d37 (talk) 02:32, 20 September 2021 (UTC)Reply
@2d37: thank you for the ping, I wonder if @Mr. Stradivarius: would be able to go over this? — xaosflux Talk 09:40, 20 September 2021 (UTC)Reply
@2d37 and Xaosflux: Thank you for the update to the sandbox! I've made a couple of tweaks to it. First, I switched from and/or-style syntax to if/else-style syntax in getYearAndName - there was nothing wrong with the logic itself, but I think the if/else style is easier to read, especially when you have to raise errors. I also tweaked the code that handles date arguments to avoid the and/or style when raising errors there as well. I'm not so sure about the naming of the new |root= parameter - I think this may be clearer as "basepage", or something else that makes it clearer that we are talking about a page. Other than that, this seems good to go. Feel free to use or ignore my suggestions and code as you see fit, and feel free to deploy this to the main module. Best — Mr. Stradivarius ♪ talk ♪ 13:35, 20 September 2021 (UTC)Reply

I switched from and/or-style syntax to if/else-style syntax in getYearAndName

I initially wrote getYearAndName with an ifelse chain and changed it to andor conditionals because I thought it was too verbose; I don't object to its being changed back to ifelse.

the new |root= parameter - I think this may be clearer as "basepage"

I'll rename |root= to |rootpagename= for clarity. It was originally |base=, but I realized that it's meant to be the ROOTPAGENAME, not the BASEPAGENAME. It shouldn't normally need to be used anyway.
2d37 (talk) 01:53, 21 September 2021 (UTC)Reply
Hey 2d37, thanks for making this fix! I just stumbled upon this error recently as well and pushed a naive fix (which I've now reverted). It looks like your much more elegant solution didn't make it from the sandbox to the main version; would you be able to take a look and see if it could be implemented? Thanks! — Frostly (talk) 03:27, 4 October 2023 (UTC)Reply
Thanks for your interest in getting those changes applied. I can try to forward-port those changes some time this month (after the present weekend, at the earliest), but I'm not sure I would be better at doing so than anyone with the relevant Lua knowledge, now that more than two years have passed since I wrote that code. :-) Feel free not to wait for me if I take too long. —2d37 (talk) 03:53, 7 October 2023 (UTC)Reply
2d37, just wanted to follow up :) — Frostly (talk) 22:37, 20 October 2023 (UTC)Reply
@Frostly and 2d37: I added the ability to specify the year, and also to fetch data from Template:Arbitration Committee candidate/data. If that template is up to date, you should only have to specify the year and the voter guides now. — Mr. Stradivarius ♪ talk ♪ 14:24, 23 October 2023 (UTC)Reply
Mr. Stradivarius, I think the module still has 2022 hardcoded for the guide category? — Frostly (talk) 23:56, 23 October 2023 (UTC)Reply
@Frostly: Well spotted - fixed. — Mr. Stradivarius ♪ talk ♪ 00:53, 24 October 2023 (UTC)Reply