Template talk:Medals table

Initial creation
I would like a template for medal table (example 2018 Asian Games medal table) so the total number of medal could be computed automatically. Currently Infobox country at games has this feature. Hddty. (talk) 05:01, 29 August 2018 (UTC)
 * I like this idea. Think it might be a good candidate for a module... -- Zackmann08 (Talk to me/What I been doing) 21:40, 16 September 2018 (UTC)
 * this is going to take me a few days but I hope to have a proof of concept done mid week. :-) -- Zackmann08 (Talk to me/What I been doing) 22:16, 16 September 2018 (UTC)
 * can you take a look at Medals table and let me know what you think? Still working out a few kinks... But would love some feedback! -- Zackmann08 (Talk to me/What I been doing) 22:36, 17 September 2018 (UTC)
 * Cool! I didn't expect the column would be merged if the NOC has the same rank. My suggestion is, since the ranks are automatically generated based on medal, maybe better to use IOC codes to distinguish the parameter instead of number (example goldCHN, thus we don't need nation1). Sometimes in the main article we only display top 10 NOC + "Remaining NOCs" by transclusion (see 2016 Summer Olympics, sometimes not, see 2018 Winter Olympics) is this template able to do this? Also NOCs total number needs to be displayed in the bottom of the table. Hddty. (talk) 02:33, 18 September 2018 (UTC)
 * well much of the credit goes to for her assistance! The use of the IOC codes is an interesting idea... Not sure whether it is practical to implement that in a module.  do you have any thoughts? I'm happy to try to implement it, but I'm curious what you think. -- Zackmann08  (Talk to me/What I been doing) 03:46, 18 September 2018 (UTC)
 * IOC codes should be possible by calling Module:Country alias. I would suggest gold_CHN or goldCHN with the ability to override the display name with nameCHN or name_CHN, but if the name parameter isn't there, then it looks up the name from the 3 letter abbreviation using Module:Country alias.  the other interesting feature with 2016 Summer Olympics medal table is the ability to show the full table on 2016 Summer Olympics medal table but only part of the table on 2016 Summer Olympics.  there are a few ways we could accomplish this, but the method used by Template:2004–05 FA Premier League table is probably the most obvious (see the show_limit parameter and 2004–05 Chelsea F.C. season). Frietjes (talk) 13:27, 18 September 2018 (UTC)

I like it! You really have a knack for this stuff. Greatly appreciate your counsel here. I'm going to play around with the above idea and see what I can come up with. Give me a day or two. :-) -- Zackmann08 (Talk to me/What I been doing) 18:06, 18 September 2018 (UTC)
 * how does this look? Test it out and let me know if you have any thoughts or feedback. I would LOVE your assistance with improving the documentation. If anything is unclear please let me know.
 * I opted not to use the module you mentioned, partially because I don't entirely understand it... Instead what I am doing is invoking a template. The default template (if none is provided) is just Flagteam, but any of the templates in the should work. Thoughts? -- Zackmann08  (Talk to me/What I been doing) 18:44, 18 September 2018 (UTC)
 * If you look at 2016 Summer Olympics the table is transcluded from 2016 Summer Olympics medal table but only showing top 10 ranked NOC + "Remaining NOCs", can this template do this? Sometimes we transcluded full table (see 2018 Winter Olympics). Hddty. (talk) 02:58, 19 September 2018 (UTC)
 * uhhhh that's a good question. I shall look into it! -- Zackmann08 (Talk to me/What I been doing) 04:12, 19 September 2018 (UTC)
 * ok so I made it happen! Here's how it will work... You create a template that is the table. (See Template:Medals table/testcases-show-limit). This template takes 1 or 2 params. The show limit and the link for "remaining". Then anywhere you want that table to appear, you just call the template. So as an example:

gives you:

How does that look to you? :-) -- Zackmann08 (Talk to me/What I been doing) 18:38, 19 September 2018 (UTC)
 * Furthermore you can simplify the template with something like Template:Medals table/testcases-include where you do an includeonly with the limit so that when the template is included elsewhere it limits the number automatically. -- Zackmann08 (Talk to me/What I been doing) 18:43, 19 September 2018 (UTC)
 * see Templates_for_discussion/Log/2018_September_19 -- Zackmann08 (Talk to me/What I been doing) 19:25, 19 September 2018 (UTC)

I have a question. The current situation with Russion doping cases caused IAAF to exclude Russian federation, so Russian athletes participate as Neutrals, the sportpeople can win medals but they are not included (or not ranked) in the medal tables. Example European_Athletics_Championships - is it possible to achieve smth like that with this template? --Pelmeen10 (talk) 21:54, 19 September 2018 (UTC)
 * so technologically speaking, sure that could be done. I'd just need to add a param similar to that if set would cause that nation/entity to be skipped in the rankings... But honestly seems kinda weird to have them in the table but no included in the rankings. An edge case to be sure. -- Zackmann08  (Talk to me/What I been doing) 22:15, 19 September 2018 (UTC)
 * They are included in the table (if the official does not) mostly because the total medal count should match the distributed medals. Btw, how are notes added after the country? example. --Pelmeen10 (talk) 10:53, 20 September 2018 (UTC)

Last request, make the host's country color like above because coloring the whole row is excessive. Also the number of gold, silver, bronze and total in "Remaining NOCs" shouldn't be italicized. Thanks. Hddty. (talk) 23:43, 19 September 2018 (UTC)
 * ✅ -- Zackmann08 (Talk to me/What I been doing) 23:54, 19 September 2018 (UTC)
 * The host box should be put on the left. Hddty. (talk) 04:40, 20 September 2018 (UTC)
 * can you help me out with that? I tried like 10 different things but I can't get the purple box to the left of the host text... -- Zackmann08 (Talk to me/What I been doing) 04:59, 20 September 2018 (UTC)

Can you simplify it so we only need to put there. Hddty. (talk) 05:17, 20 September 2018 (UTC)
 * I mean in 2018 Asian Games medal table article that you just edited yourself to converting to use this template we need to put it like this: . Hddty. (talk) 09:45, 20 September 2018 (UTC)
 * and : (1) I moved the host note to the top of the table, but added the option to move it to the bottom with b (we can make the default bottom if this is better). (2) if you use KOR it will expand this into 'Host nation (South Korea)' for you. (3) I added an optional host_note for a footnote after this text. (3) I added note_XYZ to add a footnote for XYZ nation. (4) I added optional source and notes for source or notes at the foot of the table. we could probably make it so that KOR also toggles y, or the other way around. is there anything else that is missing? Frietjes (talk) 13:28, 20 September 2018 (UTC)
 * YOU ROCKKKKK!!!!!! -- Zackmann08 (Talk to me/What I been doing) 16:09, 20 September 2018 (UTC)

Rank... Totals or gold?
SO it seems like most tables are determining the rank based on the number of gold medals, NOT the number of total medals... Should we update the template to reflect that? -- Zackmann08 (Talk to me/What I been doing) 19:56, 19 September 2018 (UTC)
 * medal table is based on gold medals, not total. --Pelmeen10 (talk) 21:02, 19 September 2018 (UTC)
 * ✅ -- Zackmann08 (Talk to me/What I been doing) 23:54, 19 September 2018 (UTC)

Width
Hi, is that possible to give it an option to set the width of the second column (NOC) manually ? I just think something like this looks a bit ugly, other columns have more width than the country name. I mean we have fixed width for other columns. Mohsen1248 (talk) 23:36, 20 September 2018 (UTC)


 * I think it just makes things more complicated than they need to be. The point of the template is to make things look more consistent. How often do you have just 1 country in a table anyway? -- Zackmann08 (Talk to me/What I been doing) 01:48, 21 September 2018 (UTC)
 * Well if you ask me the thing was simple with the medal table. and they are now complicated. (even though I'm fine with both, no big deal) my point wasn't about having one country. (I edited my example to show you my point) but since "China" is a short name, the table looks ugly "to me" the nation column needs a bit more width than other columns in my opinion. speaking of complication, while this idea works for multisport events. what are you going to do with flag variants ? I see you edited 2000 World Karate Championships but you should know that wasn't who win that medal but  undefined and they are very different. the current template doesn't give me any option to fix that. (or at least I'm not aware if there is)
 * or this one 1910 World Weightlifting Championships only in this case both countries in the medal used exactly the same parameters for the flag, so your templates work here but what about other competitions with different flag parameters ? another thing in case of tie, the template sorts countries based on IOC Code and not their name (for example India stands above Chinese Taipei or Thailand above Tajikistan), don't you think you should fix these problems (specially flag variants) before editing hundreds of pages ? Mohsen1248 (talk) 03:06, 21 September 2018 (UTC)
 * well you may think it looks ugly to have columns be a default width but I don't see any problem with it... Additionally there is a in the documentation that overrides the default name parameter. -- Zackmann08  (Talk to me/What I been doing) 03:28, 21 September 2018 (UTC)
 * so this is it ? you don't like it and because of that you are not going to give other options ? apparently this is how things work in wikipedia recently. OK, but I still can't understand how we have "fixed" width for 3rd, 4th, 5th and 6th columns and only not for the 2nd column !
 * OK, that solves the flag variant issue but still my concern remains about the sorting countries based on NOC code and NOT alphabet (as I gave two examples). beside that you should be more careful with your edits. looks like I have to double check most of those pages for possible mistakes. for example 2015 World Weightlifting Championships you deleted one of those two medal tables considering it "duplicate". in this specific sport there are two medal tables at the end of the competition. Mohsen1248 (talk) 21:40, 21 September 2018 (UTC)
 * if you feel the need to check all my edits, knock yourself out! I have checked and when you click on the top of the column, the sorting is based on the name that is displayed, not the IOC code. If you are seeing something different, please show me where and I will take a look. But currently I cannot reproduce your issue. -- Zackmann08 (Talk to me/What I been doing) 21:57, 21 September 2018 (UTC)
 * I also agree that, by default, the table should sorting the countries that have the same rank based on alphabet because the text is placed on the left (read first). Hddty. (talk) 06:38, 22 September 2018 (UTC)
 * of course I'm going to check all pages in my watchlist (which is a big list) but when you finish it, beacuse I don't want to check them more than once. I checked few pages and there were mistakes in half of them at least. looks like you don't care about flag variants but some people do. For example here 1996 World Weightlifting Championships you used that parameter 1984 which solves it only for South Korea but we also have different flag for Japan. this is just an example there are several pages with the same problem. You say the sorting is based on IOC code, but what about this ? Mohsen1248 (talk) 09:56, 23 September 2018 (UTC)

Show limit
Hi, can you simplify the show_limit parameter from  to. Also maybe we need a parameter to display/not display "Remaining NOCs*. Thanks. Hddty. (talk) 21:33, 20 September 2018 (UTC)
 * you're missing the point... You only want the value of the to take affect when the template is included on another page. That is why you using the includeonly tags. -- Zackmann08  (Talk to me/What I been doing) 21:55, 20 September 2018 (UTC)
 * Hddty. and Zackmann08, yes, you can simplify the syntax, see the wikitext source for 2018 Asian Games and 2018 Asian Games medal table. Frietjes (talk) 11:56, 21 September 2018 (UTC)
 * I left a reply on my talk page, but what Frietjes has said above is the 2nd solution. Both work! -- Zackmann08 (Talk to me/What I been doing) 15:48, 21 September 2018 (UTC)
 * When you get a chance, curious on your thoughts regarding the last case on Template:Medals_table/testcases... I think its such an edge case that I almost don't care but.... -- Zackmann08 (Talk to me/What I been doing) 23:55, 21 September 2018 (UTC)
 * I don't know why "-" is in the left column instead of "4", followed by "6" for Turkey and "7" for Switzerland and Sweden. We should continue this at Template talk:Medals table. – Jonesey95 (talk) 04:10, 22 September 2018 (UTC)
 * Oh, now I see the note linking to this source from the 2017 world championships medal table. The "-" makes sense, but the testcases page needs a similar note. Can you make it so that the note number and the ^ are not bold? That would be more like other Notes sections, I think. – Jonesey95 (talk) 04:16, 22 September 2018 (UTC)

the test case is just that, a test case... It doesn't really need a note it was just meant to verify that the rank can be skipped. We are using that page for testing while we update the module. -- Zackmann08 (Talk to me/What I been doing) 04:25, 22 September 2018 (UTC)
 * I think a test case showing how to make the note and that it works is valuable. If something happens in the sandbox that breaks the note, that breakage will show up on the testcases page. Edge cases like this one are valuable to keep on testcases pages. – Jonesey95 (talk) 04:41, 22 September 2018 (UTC)
 * I should clarify, right now the test cases compare the old template (RankedMedalTable) to the new template/module. I'm still working out the kinks. Once we get things up and running consistently, then the test cases should be refactored so that they test the main template against the sandbox. You make a VERY good point! Thanks again. -- Zackmann08 (Talk to me/What I been doing) 04:45, 22 September 2018 (UTC)
 * it looks like the skip feature is working. basically, you have to reset the "last" parameters to make sure it doesn't try to rowspan it incorrectly.  the only thing that I didn't test is if there are two consecutive skips, or a skip between two that should have the same rank.  for the case that you have a skip between two with the same rank, we would just need to adjust the sort algorithm to include skips. Frietjes (talk) 13:18, 22 September 2018 (UTC)
 * okay, I have adjusted the sort to include the "if skip", so the skipped rows are at after the others if they have the same rank. Frietjes (talk) 13:37, 22 September 2018 (UTC)
 * I added a notice at the top of the test cases page to reflect what I said above. I would welcome any additional test cases you can think up and document.-- Zackmann08 (Talk to me/What I been doing) 22:41, 22 September 2018 (UTC)

Try it out at 2003 World Championships in Athletics
I'd like to see this template tested in a sandbox using the content from 2003 World Championships in Athletics, which has a lot of ties. Thanks. – Jonesey95 (talk) 04:10, 22 September 2018 (UTC)
 * I've already done a number of pages with ties like this so I just went ahead and converted that one for ya. Take a look. -- Zackmann08 (Talk to me/What I been doing) 04:23, 22 September 2018 (UTC)
 * Looks much better than the old one. Nice work. One nitpick: I would lower-case "nations" in the Totals cell, per MOS. While doing that, you'll have to make sure you don't lower-case the top header, though, which looks like it is re-used at the bottom. But you know that. I don't know Lua well enough to make the change. – Jonesey95 (talk) 04:28, 22 September 2018 (UTC)
 * would love to hear your thoughts on Templates_for_discussion/Log/2018_September_19. -- Zackmann08 (Talk to me/What I been doing) 04:30, 22 September 2018 (UTC)

Glitches
Would someone please fix the changes to use this template at the following. They are currently showing messages like "Lua error in Module:Country_alias at line 1778: Invalid country alias: PIC". Johnuniq (talk) 01:12, 23 September 2018 (UTC)
 * 2003 FESPIC Youth Games
 * 2008 Oceania Athletics Championships
 * 2010 Thailand National Games
 * 2011 Thailand National Games
 * 2012 Thailand National Games
 * ✅ sorry about that! Please ping me directly if you find any more. Still working out all the kinks. -- Zack mann  (Talk to me/What I been doing) 01:52, 23 September 2018 (UTC)
 * Thanks! Johnuniq (talk) 02:10, 23 September 2018 (UTC)

@2016 Winter Youth Olympics After 10, there shouldn't be 12. --Pelmeen10 (talk) 20:02, 23 September 2018 (UTC)
 * seriously you're killing me smalls!!! (Said 100% in jest) Another great catch. Do you understand why it is happening? Basically it is skipping the `mixed` team in the numbers. If you look at the main table you will see the numbers are correct. Should be an easy fix... let me take a look. -- Zack mann  (Talk to me/What I been doing) 20:52, 23 September 2018 (UTC)
 * alright should be fixed now. Keep up the great work! Do me 1 small favor? If and when you find more errors like these, ping me in your comments to make sure they are immediately brought to my attention? Thanks mate!!! -- Zack mann  (Talk to me/What I been doing) 20:55, 23 September 2018 (UTC)


 * should be alphabetical order? And the way how host is displayed, should be somewhat similar in every case, but sometimes it includes wikilink, sometimes it even includes flag... --Pelmeen10 (talk) 14:48, 26 September 2018 (UTC)
 * probably fixed now. Frietjes (talk) 18:29, 26 September 2018 (UTC)

Found an error with using tooltip in "Team" parameter. Also NOC becomes "nocs" under Totals. --Pelmeen10 (talk) 09:08, 7 October 2018 (UTC) 2018 Winter Olympics medal table
 * Pelmeen10, fixed. Frietjes (talk) 15:08, 7 October 2018 (UTC)

Request for migration to fix table-related Linter error
I've tried to fix a table-related Linter error at 2015 European Games medal table, to no avail. Can it be migrated to use the module? Note that it has an onlyinclude statement because part of the table is transcluded in another article. Thanks. – Jonesey95 (talk) 17:57, 23 September 2018 (UTC)
 * Thanks, that was quick! The Linter error category in article space is now empty! (or was, after this last article was fixed; editors are always messing up tables, so if you check it after reading this, there are probably one or two in there) – Jonesey95 (talk) 07:30, 24 September 2018 (UTC)

Symbol for skip in rank
Is it correct if we use em dash there instead? The punctuation is often used in discography article to denotes a recording that did not chart. Hddty. (talk) 09:20, 24 September 2018 (UTC)
 * I'd actually put "–" (en dash?), which is used in various articles/sports tables. And if "-" is used, this dashes script will fix it to "–" (for this medal table, ofc this script won't work). --Pelmeen10 (talk) 11:46, 24 September 2018 (UTC)
 * At least it should be changed to en dash/em dash. Hddty. (talk) 14:09, 24 September 2018 (UTC)
 * change "-" to "–" please. --Pelmeen10 (talk) 04:24, 5 October 2018 (UTC)
 * ✅ -- Zack mann  (Talk to me/What I been doing) 05:29, 5 October 2018 (UTC)

Should the nations with zero medals be also marked with "–" rather than having a rank? --Pelmeen10 (talk) 13:21, 25 September 2018 (UTC)

Possible problem with flags using ISO/IOC/FIFA codes that are different
What code are you setting for Antigua and Barbuda? 2003 Pan American Junior Athletics Championships Netherland Antilles appears twice there. --Pelmeen10 (talk) 00:37, 24 September 2018 (UTC)
 * please try to indent and keep consistent with talk page format... Figure out the issue. the name param is overriding the host format. I can look at it later but just an FYI. About to have dinner... -- Zack mann  (Talk to me/What I been doing) 01:00, 24 September 2018 (UTC)
 * I believe that I fixed the Antigua and Barbuda problem with this edit. Revert me if I got it wrong. – Jonesey95 (talk) 07:40, 24 September 2018 (UTC)
 * Self-reverted. This is a bit of a mess. For Antigua and Barbuda, the IOC code is ANT, but the ISO code is ATG.
 * For Netherlands Antilles, the IOC code is AHO, but the ISO code (and the FIFA code) is ANT.
 * Template:Country data ANT redirects to Netherlands Antilles., your table replacement script may need to be adjusted, or the module may need to call the flags in a different way to ensure that IOC codes are used to match flags, not FIFA or ISO codes. I do not envy you your journey through this morass. See Template talk:Country alias for more. – Jonesey95 (talk) 08:11, 24 September 2018 (UTC)
 * I once raised the problem (using wrong codes) here. "BRN" is another one (IOC code for Bahrain, but ISO code for Brunei). --Pelmeen10 (talk) 11:54, 24 September 2018 (UTC)

2 letter codes?
what are your thoughts on adding support for 2 letter codes in addition to 3 letter ones... This would facilitate things like, , etc.? I could see benefits but also a number of drawbacks. Curious what you think? -- Zack mann  (Talk to me/What I been doing) 19:06, 24 September 2018 (UTC)
 * , is there an article that needs this? Frietjes (talk) 19:09, 24 September 2018 (UTC)
 * 1988 IAAF World Cross Country Championships is one example. Now I can get around it using ... . But I'm curious whether adding the 2 letter codes might be a good idea. -- Zack mann  (Talk to me/What I been doing) 19:12, 24 September 2018 (UTC)
 * I strongly recommend supporting only one list of official country codes, if possible. See the section immediately above for the problems that can happen when there are multiple lists of country codes. In the documentation, make it extremely clear which list is supported. – Jonesey95 (talk) 19:58, 24 September 2018 (UTC)
 * my feeling is that everything is passed through the specified (or implicitly specified) flag template. so, if the flag templates are allowing for different country codes, that's a problem that should be addressed in the flag templates. however, I don't see any problem with moving toward a single set of official country codes for consistency between articles. Frietjes (talk) 20:07, 24 September 2018 (UTC)
 * God that would be AMAZING!! If only we could achieve that level of consistency... -- Zack mann  (Talk to me/What I been doing) 21:09, 24 September 2018 (UTC)
 * See the section above. At some point, the documentation should say what will happen when someone uses ANT or BRN as a country code. A choice needs to be made and documented by the designer of the template. – Jonesey95 (talk) 03:34, 25 September 2018 (UTC)

What is the sense of the last row?
I mean, what is the sense about "Totals"? In the 99% of the cases, total of golds will be the same as silvers and bronzes. Asturkian (talk) 19:52, 26 September 2018 (UTC)
 * I STRONGLY disagree... Having converted about 98% of the pages myself, very few of them have matching totals across all three. -- Zack mann  (Talk to me/What I been doing) 22:44, 26 September 2018 (UTC)
 * Here are the first four pages on the "What links here" list: not matching, not matching, matching, not matching. A small sample, but a tiny amount of research supports a Totals row. – Jonesey95 (talk) 03:14, 27 September 2018 (UTC)

How the....
So question... How the heck do we want to deal with cases like this? (Taken from 1987 Pan American Games medal table. We can't accept 169/168 as a value for because it won't compute with the math for finding the totals. In theory we could add a  or similar that would override the mathematical value and display a custom value, but I feel like if we start doing things like that it (A) Makes this WAY more complicated than it should be and (B) kind of defeats the purpose of the template to begin with. My feeling is that if you have a table like this, then you should really just create a custom table. Thoughts? -- Zack mann  (Talk to me/What I been doing) 18:43, 27 September 2018 (UTC)
 * I would pick the source that seems most trustworthy (or find a new, better one), use the numbers from that source, and preserve the notes explaining the possible discrepancies. – Jonesey95 (talk) 18:54, 27 September 2018 (UTC)

Add some color?
So working through converting some of the old ones and was curious what everyone thought of this manifestation? I kind of like having the colored columns. Any thoughts? -- Zack mann  (Talk to me/What I been doing) 01:38, 1 October 2018 (UTC)
 * Make sure to read MOS:COLOR first. It may have some insights for you. – Jonesey95 (talk) 06:33, 1 October 2018 (UTC)

Another case to address
So I've come across another case we need to address (taken from FIS Nordic World Ski Championships 2009)...

Now there is a workaround I can do which is:

But that is obviously ugly as heck.... So I'm looking for suggestions. For 99% of the tables, just doing gold_ or silver_<3-letter-code> works fine. But for cases where a 3 letter code is not applicable, do we want to allow for other options? One thought I had was that we could also allow, i.e. , , , etc... Obviously would match up with , ,  etc. One thing that would we would have to do is that if you use a numbered param (instead of 3 letter codes) you MUST provide a display name.

My concern is that this is starting to get a bit complicated. I'm all for making templates work for as many cases as possible, but I wonder whether this might be a case where there should just be a second template? you're the absolute expert here so I'll defer to you on the technical side of things, though I am more than happy to do the coding myself. -- Zack mann  (Talk to me/What I been doing) 00:34, 2 October 2018 (UTC)

Another example from Singapore at the 2006 Asian Games: -- Zack mann  (Talk to me/What I been doing) 01:11, 2 October 2018 (UTC)
 * I'm lazy, so I would do the 99% first and then look at the edge cases that are left to see if there is a way to address them together. – Jonesey95 (talk) 04:16, 2 October 2018 (UTC)
 * What about we edit the table instead like below.


 * It looks weird to me that the athletes' name is sandwiched between the flag and the IOC code. Maybe it edited that way because RankedMedalTable don't have another column.
 * I support the addition of etc so it would work on Singapore at the 2006 Asian Games. Hddty. (talk) 05:07, 2 October 2018 (UTC)
 * You could also add optional columns with labels, so that Athlete and Name of first athlete, or something like that. That would allow for a label like "Sport" or "Athlete", populated by items of the editor's choice. – Jonesey95 (talk) 10:16, 2 October 2018 (UTC)
 * I like the 2nd table above with a separate column for Athlete and Nation.. That being said, I think this template is going to get too confusing. Not just in terms of complicated module code, but in terms of implementations... My vote at this point would be to create a athlete medals table or something of that nature... But that doesn't solve the initial problem of Sports instead of country tables... SO basically there seem to be 2 issues:
 * 1) How do we handle the case where instead of rows representing nations, the rows represent a sport, club or some other entity that cannot accurately be represented by a 3 letter code.
 * 2) How do we handle the case where the rows are for athletes, many of whom may be from the same country and thus cannot use the 3 letter country code as there would be duplication.
 * My thinking at this point would be make case 1 work with this template but to create a second template for case 2. Thoughts? -- Zack mann  (Talk to me/What I been doing) 17:09, 2 October 2018 (UTC)
 * So.... That was WAY easier than I thought it was going to be.... lol!!!! See Template:Medals table/testcases. Added like 15 characters of code and got it to work. PLEASE sanity check my work to make sure nothing else broke in the process.... but it looks like it worked! -- Zack mann  (Talk to me/What I been doing) 17:54, 2 October 2018 (UTC)
 * I think the "rank" column for Singapore at the 2006 Asian Games is very confusing. The rank is not their rank in that specific sport's medal table (compare to Singapore_at_the_Olympics) rather than list of their most successful sports. Never seen this type of "medal table" in Wiki before. Is this the only one like that? Maybe this should be changed to regular wikitable instead? --Pelmeen10 (talk) 18:24, 2 October 2018 (UTC)
 * About the first example - it's also a bit funny one, because it's top10 most successful athletes usually, so "totals" row is quite pointless there i think. --Pelmeen10 (talk) 18:29, 2 October 2018 (UTC)
 * Top be clear, that is how the table was to begin with... I just converted it over to use the new template. It had the rank already. You're point isn't without merit, but I just want to be clear that it isn't like the rank was suddenly added. Personally, I think the rank IS useful and not the least bit confusing. It shows which sports that team/country have gained the most medals in. Additionally, since I've converted nearly every single transclusion of the template, I can tell you that this absolutely isn't the only case like this. I've seen dozens of them.
 * Your second point is also a good one. We can easily add a . That work for ya? -- Zack mann  (Talk to me/What I been doing) 18:32, 2 October 2018 (UTC)

Adding hide_totals
Continuing from above but under a new heading... I'm more than happy to add. Will only take me a minute or 2... But this might be a great opportunity for you to learn some Module stuff if you are interested? If you'd rather not no worries! Everyone has different interests with editing wikipedia so like I said, I'm happy to do it myself, but if you want to give it a try I added a new testcase already and you can experiment with Module:Medals table/sandbox. At the bottom you will see Preview page with this module. If you drop Template:Medals table/testcases into that field you can preview the results as you go. Let me know if you want to try it out and I'm happy to help. Otherwise, as I said, I'm happy to do it myself. :-) -- Zack mann  (Talk to me/What I been doing) 18:38, 2 October 2018 (UTC)

Template:Flagteam as default
The medal tables usually contain plain country names. "Flagteam" add 3 letter code in parenthesis which is not necessary in most cases. Many sports don't have any codes for countries and many sports are not connected to the Olympics (IOC codes). --Pelmeen10 (talk) 18:39, 2 October 2018 (UTC)
 * thanks for discussing here. I'd like to get input from and any others watching this... But it takes about 5 seconds to change the default parameter in the Module. I want to avoid having a default in the documentation like you did. It is better to just have a default in the module that can be over-ridden. TBH I actually agree with you. Initially this was designed with the focus on the Olympics which always has 3 letter codes... But most other sporting events do not, so unless one of the others raises something I haven't thought of, I think making the default flagcountry is a good call. Lets give it a day or 2? Without objection I will then change it. :-) -- Zack mann  (Talk to me/What I been doing) 18:45, 2 October 2018 (UTC)

Host nation shading
Was it intentional to change the host nation shading so that just the NOC cell is now highlighted and not the whole row? Or was it just something that got accidentally altered in the translation? Personally I preferred it when the whole row was highlighted so that you could see at a glance how many medals the host nation won. It's only my personal opinion but I thought the idea was to translate the tables seamlessly so that no-one would notice the difference. Rodney Baggins (talk) 13:34, 3 October 2018 (UTC)
 * you are correct that the idea was to translate the tables seamlessly. I'd like to chime in here since she was the one to make that specific change but I think the situation below illustrates one reason that this was done. I.E. the rank being colored for both Cuba and USA when USA was the host. That being said... we could add the color to everything except for the rank? I'm certainly open to any ideas. Thanks for bringing this point up. Do know that if the decision is made to color the whole row instead of just the 1 cell, that change can easily be made in the module and will automatically be reflected on all the pages. -- Zack mann  (Talk to me/What I been doing) 16:38, 3 October 2018 (UTC)


 * it was who asked above make the host's country color like above because coloring the whole row is excessive. ([//en.wikipedia.org/w/index.php?title=Template_talk%3AMedals_table&type=revision&diff=860336332&oldid=860327178 diff]) to which  replied Done ([//en.wikipedia.org/w/index.php?title=Template_talk:Medals_table&diff=next&oldid=860337426 diff]) after making the change [//en.wikipedia.org/w/index.php?title=Module:Medals_table&diff=next&oldid=860336757 here]. Frietjes (talk) 16:52, 3 October 2018 (UTC)
 * I am SO sorry! You're 100% right it WAS me!!! I want to be clear here, I was NOT trying to throw you under the bus!! I thought you had made that change and wanted to get insight into your decision. My apologies. -- Zack mann  (Talk to me/What I been doing) 16:59, 3 October 2018 (UTC)

Template:MedalTable
So looking at starting some work on Template:MedalTable... Trying to decide whether to make it work with this template or do a separate Template/Module. Thoughts? -- Zack mann  (Talk to me/What I been doing) 02:57, 5 October 2018 (UTC)

{{legend|#E9D66B|Leading in that sport}}

Bahrein and Brunei
Currently the template displays BRN and BRU as Brunei, and BHR as Bahrein. But according to the List of IOC country codes, BHR does not exist, BRN is the code for Bahrein and BRU is the code for Brunei. -- ThiagoSimoes (talk) 02:07, 13 October 2018 (UTC)
 * See the section "Possible problem" above. – Jonesey95 (talk) 05:58, 13 October 2018 (UTC)

Accessibility issue in FL medal tables
I noticed a little while ago that the table formatting in a medal table list I have on my watchlist was converted into the output from this template. That article is a featured list, and most of the formatting looks up to that standard. However, I'm not sure that tables formatted with this template meet the accessibility guidelines that featured lists should follow. The problem is it doesn't look like the tables include row and column scopes for web browsing tools like screen readers, as described here. As the featured list director, and primary contributor to that list I mentioned earlier, it would be quite unfortunate if using the seemingly nice-looking formatting from this template actually caused lists to not meet the FL criteria, so I'd like to request that support for scopes be added if at all possible. If it helps, I saw a comment at the merge discussion for Template:Medal table which indicates support for at least the column scopes exists in that template. If some formatting could be copied from that template to provide scope support here, that would be fantastic. Giants2008 ( Talk ) 15:17, 14 October 2018 (UTC)
 * probably done. Frietjes (talk) 15:32, 9 June 2019 (UTC)

Zero medal rows
Hi, I notice that the Lua code relies upon the existence of a "gold" field in order to produce an output row for an IOC. Can this be modified to pickup any of gold, silver, or bronze? This will allow us to omit needless zero medal inputs. Thanks SFB 12:35, 9 June 2019 (UTC)
 * , should work now. Frietjes (talk) 15:28, 9 June 2019 (UTC)

Request for additional columns
Is it possible to give an option to add extra columns with arbitrary content? It would be usefull to be able to use this template for "Medals by Summer Games" and "Medals by Winter Games" tables in numerous "Country at the Olympics" articles. For example Austria at the Olympics. Almost all of these tables have additional columns "Athletes" and "Rank", which cannot be displayed using Medals table template. Nitobus (talk) 11:15, 7 June 2020 (UTC)

Plural of country
Not a big issue, but here the totals is spelled "countrys" instead of "countries". (I've removed the spelling error now by simply replacing country with nation, but handling this case in the template's code nevertheless would be nice.) --Cyfal (talk) 19:29, 22 October 2020 (UTC)
 * I don't know Lua, but some part of Plural could probably be deployed in the code here. – Jonesey95 (talk) 19:46, 22 October 2020 (UTC)
 * This is still a problem causing spelling errors. Suggesting low quality for articles that use this template! Graeme Bartlett (talk) 04:56, 16 August 2022 (UTC)
 * Gnarly challenge – one ointment fly is that not all words ending in "y" pluralize to "ies", eg "Florida keys". Probably better just to remove everything except "Totals", as has been done in the module sandbox. (See User:Paine Ellsworth/Sandbox2 for example table.)  P.I. Ellsworth &thinsp;, ed.  put'r there 12:06, 16 August 2022 (UTC)
 * ✅ – no longer calls team that resulted in "countrys", just reads "Totals ('#' entries)".  P.I. Ellsworth &thinsp;, ed.  put'r there 16:07, 17 August 2022 (UTC)

Cell color
In mobile version the cell in countries color is gray. Could it be changed to white instead of gray? Hddty (talk) 03:43, 24 July 2021 (UTC)
 * ❌ (as to the immediate edit request). Please make your changes in the sandboxes and verify test cases before activating the edit request. Feel free to continue discussing this below in the event someone else would like to work on it. —  xaosflux  Talk 15:33, 30 July 2021 (UTC)
 * I don't have knowledge about the code. Hddty (talk) 13:43, 31 July 2021 (UTC)
 * yes, this can be done just by changing the color hexcode on line #31 from "#f8f9fa" to "#ffffff" and adding css to line 90. See my sandox. I'm just not sure it should be done. In my mobile view the cell in countries color is a very light gray. Does this cause WP:accessibility problems that I can't see?  P.I. Ellsworth &thinsp;, ed.  put'r there 17:12, 17 August 2022 (UTC)
 * @Paine Ellsworth: I don't think there is accessibility problems here. Since no one objected I think you can go ahead to edit this template. Thanks. Hddty (talk) 03:06, 27 January 2023 (UTC)
 * my question was whether or not the present version causes accessibility problems, as it's fairly obvious that a lighter background would not have problems with accessibility. I see no controversy here, so the protected module has been ✅.  P.I. Ellsworth &thinsp;, ed.  put'r there 12:58, 27 January 2023 (UTC)

Sort by code
Please add a parameter so that the table can be sorted by NOC Code in case of ties (current Olympics use in case of ties). Currently in case of ties, the table is sorted by country name. Hddty (talk) 09:13, 24 July 2021 (UTC)
 * ❌ (as to the immediate edit request). Please make your changes in the sandboxes and verify test cases before activating the edit request. Feel free to continue discussing this below in the event someone else would like to work on it. —  xaosflux  Talk 15:33, 30 July 2021 (UTC)
 * I don't have knowledge about the code. Hddty (talk) 13:43, 31 July 2021 (UTC)

Bolding function
This template should have the option to bold out say the most medals. Not always the most medals overall is the nation with most gold medals, so it would be nice to bold out those most total, most bronze, most silver, most gold results. 188.27.36.191 (talk) 13:40, 4 August 2021 (UTC)

Comma
Is there a way to add a comma in the "Totals" row, when the total value exceeds 999? In other words, starting with the number one-thousand? I think it should appear as 1,000 (with a comma), not as 1000 (without a comma). I was directed to this Talk Page, with my question. I was told that a comma was "optional" with a four-digit number. But ... I think that most people would use/expect a comma, when there are four digits. Plus, it's easier to read (in my opinion). Thanks. Joseph A. Spadaro (talk) 19:07, 9 August 2021 (UTC)


 * See here: Talk:2020 Summer Olympics medal table.   Thanks.    Joseph A. Spadaro (talk) 19:40, 9 August 2021 (UTC)
 * +1 This template should absolutely be adjusted to include commas. Four-digit numbers without commas look like years. Brad (talk) 23:38, 11 August 2021 (UTC)
 * Red information icon with gradient background.svg Not done: you are correct from the viewpoint of the US, the UK and China. In most of Europe it is reversed, so in the US the number 1,436.37 in most of Europe becomes 1.436,37. The practice of using a space to separate the 1000s is also common, as in 1 436,37 or 1 436.37 (both forms are common). Use of a comma to separate 1000s in Wikipedia articles is non-neutral from the global perspective. Exceptions occur of course, such as when an article is written in British English, which would use the UK form of large-number separators. Articles written in other forms of English might use a different form of separators. Where templates that are used in different kinds of English articles are concerned, the norm is to use no separators (for integers greater than 999).  P.I. Ellsworth &thinsp;, ed.  put'r there 12:51, 16 August 2022 (UTC)

Medals table with 4th, 5th and ... places
Hi there, I am building a medal table for a series of karate competitions.1 According to the rules of these competitions, the fourth to eighth places also have points. How can I create a table that includes fourth and subsequent positions? IWRUAH (talk) 11:53, 20 October 2021 (UTC)
 * In that case you can use a regular wikitable, something similar is used here. Pelmeen10 (talk) 01:43, 26 February 2022 (UTC)

Template-protected edit request on 22 February 2022
The country for the IOC abbreviation "ROC" displays incorrectly. Each NOC should display the actually name of the NOC, followed by its IOC abbreviation, e.g., "Norway (NOR). In the case of the Russian Olympic Committee, it displays the abbreviation twice "ROC (ROC). It should display "Russian Olympic Committee (ROC). Or it should display "Russian OC (ROC), if the full name is too long for tables.

Please edit the appropriate template to implement this change. Thank you.

IOC = International Olympic Committee; NOC = National Olympic Committee; ROC=Republic of China, Taiwan (when used as country abbreviation) or Russian Olympic Committee (when used a IOC abbreviation  Sparkie82 ( t • c ) 02:10, 22 February 2022 (UTC)
 * Red information icon with gradient background.svg Not done for now: this requires an edit to a module that ultimately powers the FlagIOCteam template that is used inside the "Medals table" template, a module that is used on 49,000 pages. Such high use requires a consensus for any changes. Please garner a consensus for this change before using the edit request template, and please be sure to type your request on the correct talk page at Template talk:Country alias. See also the edit request at Template talk:Country alias, which might be related.  P.I. Ellsworth &numsp;- ed.  put'r there 05:24, 22 February 2022 (UTC)

can "Macedonia" be rendered for events that pre-date the name change?
Macedonia only changed it's name a few years ago. Can there be an additional code, to render the name "Macedonia" for events before 2019, but point the link to North Macedonia? Or if it needs a separate target, point it to Macedonia (country). skakEL 12:01, 2 May 2022 (UTC)
 * In theory, yes, and in theory it should be as easy as adding  to the args call in the various   lines, but in practice I haven't used this module enough to know for sure; I would need to sandbox a few things first. I'll put this on my list, but it's rather low-priority at the moment so any other watchers are free to start working on it. Primefac (talk) 10:49, 4 May 2022 (UTC)
 * , just to circle back around to this, do you have any specific examples of where this is happening? I'm having trouble narrowing it down to where the wrong name is placed. Primefac (talk) 10:25, 8 August 2022 (UTC)

Is it possible to find all medal tables with MKD usage? I'd guess there isnt too many of them to just add |name_MKD=🇲🇰 Macedonia in them. Links to 🇲🇰 should be OK already. Pelmeen10 (talk) 06:21, 3 August 2022 (UTC)
 * Probably, but the issue comes from the flag_template parameter. For example, at 2000 Summer Olympics medal table flagIOC and so the correct name/flag is called. I'm not sure the best way to check for both code and template. Primefac (talk) 10:25, 8 August 2022 (UTC)

Multiple host countries
Currently not the best way to display them if there are 2 (or more) hosts such as in 2015_Winter_Universiade - displayed as "Host nation (Spain)Slovakia". Should have a better solution. Pelmeen10 (talk) 02:49, 3 August 2022 (UTC)
 * any ideas? Pelmeen10 (talk) 06:26, 3 August 2022 (UTC)
 * If I get some time this weekend I'll take a look (and at the issue in the section above). Primefac (talk) 08:23, 6 August 2022 (UTC)
 * ✅ using host1 and host2. If you actually do find someone with a third host, I can probably add that in as well. Primefac (talk) 09:19, 8 August 2022 (UTC)
 * what happened to the blue square with * ? Pelmeen10 (talk) 16:26, 16 August 2022 (UTC)
 * Miscounted the if statements, should be fixed now. Primefac (talk) 18:51, 17 August 2022 (UTC)

Template-protected edit request on 16 April 2023
I would like to sync this template's module with my current revision of its sandbox (, diff); I've simplified the logic by replacing instances of  with , and also fixed some inconsistencies in the formatting. My version passes all of the /testcases. {&#123;Lemondoge&#124;Talk&#124;Contributions&#125;} 22:33, 16 April 2023 (UTC)
 * ✅ * Pppery * it has begun... 01:46, 17 April 2023 (UTC)

Collapsible rows
Could there be an additional option in which, for example, the first 30 rows are visible and the rest are collapsed but expandable. All-time Olympic:Complete ranked medals is very long with 154 entries, but it also shouldn't be shortened with the "show_limit" to summarize remaining entries. Miria~01 (talk) 12:57, 9 September 2023 (UTC)

Totals (n entries) is a false statement
To state the number of countries as a number of entries is simply false. To take the example of the 2022 European Cross Country Championships, the table states that there were 10 entries: that is wrong. There were 40 nations taking part.The current presentation suggests that no team at the event did more poorly than Belgium and Finland, while the truth is that 30 national federations looked jealously at the results that they had. This number adds no meaningful information (a glance at the final number in the ranking competition will satisfy the interest of anyone who could be interested in such an esoteric piece of data), and serves only to mislead.

It should be removed. Kevin McE (talk) 09:16, 1 December 2023 (UTC)
 * If only ten teams win medals, then only ten teams are listed on the medal table. Thus, there are ten entries in the table. I'm not sure why this is an issue. For a larger table like the 2020 Olympics it is rather useful to know how many countries earned medals when the table is that long. Primefac (talk) 13:19, 1 December 2023 (UTC)
 * No: there were 206 nations that entered the 2020 Summer Olympics. Nobody considers the scope of an event by entries on the medal table rather than nations entering the tournament.  That is what describes the depth of competition and to what extent it is an acheivement to attain even one medal.
 * It requires a very quick count of the teams that are joint last in the table to see how many teams appear there: that argument for the misleading claim might have some relevance if there were no rankings table. I really doubt that the number of nations gaining a medal in an historic games is really a piece of data that many people seek out: if there were demand for it, one suspects that someone would have seen fit to include a column here.  And if it is not considered worth collating for the Summer Olympics, where is it a matter of interest?  Google searches suggest that it is not.
 * Is there any evidence that it is considered worthy of recording in Reliable Sources? Looking at 2016 games, Inside the Games,ESPN and CBS Sports (the first three non-wiki results on a Google search) all give full lists without a total. Or is it just WP:Synth because someone noticed that we can? Kevin McE (talk) 11:34, 5 December 2023 (UTC)

Use Module:Flagg
I switched the template to use Module:Flagg instead of flagteam or flagcountry, which should reduce the WP:PEIS on larger pages. I also added a few tweaks to improve the display of certain flags and better detect when historical flags should be used. All the testcases looked good after this change, but let me know if you come across any unintended consequences. --Ahecht (TALK PAGE ) 18:55, 18 April 2024 (UTC)

Dark mode
I think that the new dark mode makes it necesarry to change the template. E.g. in the article 2022–23 Grand Prix of Figure Skating Final the only problems in dark mode are the three medal tables. I hope that some minor changes in lines like defaultRowColor = '#ffffff' in Module:Medals table are enough. Kallichore (talk) 22:06, 19 July 2024 (UTC)