Template talk:High-use

Jump to navigation Jump to search

Typo[edit]

I believe that "Tranclusion" in the template text should be "Transclusion" instead. In accordance with the warning displayed on the template page, I'm mentioning this typo here, instead of just going ahead with the change. Let me know if it can be fixed. Thank you. Toccata quarta (talk) 10:54, 12 September 2020 (UTC)

Toccata quarta, Fixed --Trialpears (talk) 11:41, 12 September 2020 (UTC)

Maths error[edit]

The |all-pages=yes code seems to be broken, and is implausibly low results. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 22:08, 15 September 2020 (UTC)

Are you saying that the value of 5% shown here is incorrect? If so, what would be a more plausible value? If not, where are you seeing an incorrect figure? --Redrose64 🌹 (talk) 22:19, 15 September 2020 (UTC)
My mistake; I was confusing "pages" with "articles". Apologies. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 12:00, 16 September 2020 (UTC)

formatNum is being applied to a non-numeric string[edit]

When |1=risk and the bot doesn't have a count, the phrase "a very large number of" is inserted. It appears that later in the code, formatNum is applied to that text, which is usually a number. That process puts pages like {{BLP editintro}} into the new tracking category Category:Pages with non-numeric formatnum arguments, since formatNum is supposed to be applied only to pure numeric values.

I don't know Lua well enough to modify this module's code, but can someone please try to find a way to avoid applying formatNum to this prose? I see that "approximately" is added a a post-processing step; perhaps "a very large number of" could be inserted at that point as well, instead of being inserted before number formatting is attempted. – Jonesey95 (talk) 14:03, 29 September 2020 (UTC)

The issue is in Module:Transclusion count at
	-- If database value doesn't exist, use value passed to template
	if return_value == nil and frame.args[1] ~= nil then
		local arg1=mw.ustring.match(frame.args[1], '[%d,]+')
		return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R'))
		frame.args["nobot"] = true
	end
Seeing if I can sort. --Izno (talk) 15:01, 29 September 2020 (UTC)
Nope, have not managed to sort it in either of the two places it might be. Ahecht? --Izno (talk) 15:24, 29 September 2020 (UTC)
I don't think that's it, but I could be wrong. formatNum with "R" does not appear to cause this category to be applied. – Jonesey95 (talk) 16:23, 29 September 2020 (UTC)
True. {{formatnum:1000 million}} and {{formatnum:1,000 million}} both put a page into Category:Pages with non-numeric formatnum arguments but {{formatnum:1000 million|R}} and {{formatnum:1,000 million|R}} do not. The comma makes no difference, it's purely the absence or presence of the |R. --Redrose64 🌹 (talk) 20:16, 29 September 2020 (UTC)
Does that make it a bug? Not sure what R does... --Izno (talk) 21:01, 29 September 2020 (UTC)
R is meant to strip commas rather than add them. Behaviour described seems expected. Strings containing commas should probably not be sent to formatnum, although a non-comma string to formatnum with R doesn't seem to hurt. ProcrastinatingReader (talk) 21:41, 29 September 2020 (UTC)
Not just meant to, but actually does so:
  • {{formatnum:1000000}} → 1,000,000
  • {{formatnum:1,000,000}} → 1,000,000
  • {{formatnum:1000000|R}} → 1000000
  • {{formatnum:1,000,000|R}} → 1000000
This is documented at H:MW#Formatting. --Redrose64 🌹 (talk) 22:19, 29 September 2020 (UTC)
Have updated the module with something that shoudl fix it. arg1 regex only returns digits and commas, non-digit strings will be empty - empty check on string should fix issue. ProcrastinatingReader (talk) 21:26, 29 September 2020 (UTC)
I'm not sure which module is being referenced here. Module:High-use has not been modified, and {{BLP editintro/doc}} is still in the relevant error-tracking category. – Jonesey95 (talk) 22:52, 29 September 2020 (UTC)
Relevant lines are 27-33. --Gonnym (talk) 23:17, 29 September 2020 (UTC)
ProcrastinatingReader, if you are referring to this edit of Module:Transclusion count, see the discussion above regarding the "R" option. I don't think Module:Transclusion count is causing formatnum to receive badly formatted text.
Gonnym, it sounds like you are referring to lines 27–33 of Module:High-use. I agree, and would also include lines 10–15. Can the functionality in lines 10–15 be invoked after the number is formatted? Maybe the logic could be reversed as follows: "if 'count' is not nil, do what is currently in the 'else' statement (lines 16–39); otherwise, run the code that is currently in lines 10–15." [edited to add: On second thought, I don't see how lines 27–33 are involved, based on my understanding of if/else/end statements. I'm confused.] – Jonesey95 (talk) 00:21, 30 September 2020 (UTC)
Jonesey95, my bad. Added a truthy check now (reason required: match returns nil not empty). try now - cat gone from doc. re your comment above, I believe main offender in that module is line 6/62, but doesn't really matter for fix I think - different module. ProcrastinatingReader (talk) 00:42, 30 September 2020 (UTC)
ProcrastinatingReader, thanks for digging into and fixing something that I clearly do not comprehend fully (hence my "I could be wrong" weasel disclaimer above). And Izno, it looks like you were right after all. Thanks to your both for your attention to this trivial detail. – Jonesey95 (talk) 02:08, 30 September 2020 (UTC)

Is there a bot applying this template as needed?[edit]

I noticed that it does not appear at {{Infobox song}}, despite that template appearing on close to 70,000 pages. {{u|Sdkb}}talk 02:47, 23 December 2020 (UTC)