Template talk:Wins-losses-pct in table

From Wikipedia the free encyclopedia

Overlap in functionality[edit]

There is overlap in functionality with {{Winning percentage}}. I see the advantage to this template in that it automatically generates table markup, but the mathematical computations are incorrect (0 wins and 0 losses isn't .000, it's NaN). This template should use the {{Winning percentage}} to calculate the winning percentage so that the logic isn't duplicated between the two. Also, IMO, this template should be renamed to something like {{Win-loss-pct in table}} with redirects ({{winpcttable}} for example) to shorten what needs to be typed. — X96lee15 (talk) 14:12, 5 December 2014 (UTC)[reply]

So I addressed the divide by zero if there are 0 total games. Shouldn't be too tough to make this use the {{Winning percentage}} template. — X96lee15 (talk) 19:31, 12 November 2015 (UTC)[reply]
@Dmoore5556, X96lee15, and McVahl: I've now added an optional third parameter for ties. If present, it produces an additional column for the value after losses, and adds half it's value to the percentage. I also took out the calculation code and transcluded {{Winning percentage}} instead. I updated the doc and added test cases for the new parm. I'm kind of rusty at this, so I hope it's OK; let me know if there are any problems. —[AlanM1 (talk)]— 17:47, 31 December 2023 (UTC)[reply]
@AlanM1:, thank you very much. I have a few places I'll be using the template with ties. I will advise back if anything seems amiss. Dmoore5556 (talk) 18:28, 31 December 2023 (UTC)[reply]