Jump to content

Module talk:Sports table/Archive 2

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Lowercase sigmabot III (talk | contribs) at 10:24, 11 July 2020 (Archiving 1 discussion(s) from Module talk:Sports table) (bot). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 1Archive 2

Again on some bugs I noted

Hi, I'm again here with some bugs/feature requests I would like to note. All of them are in my sandbox, but they can be summed up as two main problems:

  1. compatiblity and/or showing of bonus/penalty/starting points; and
  2. editable played/points columns.

For each problem I've presented a couple of examples of what I mean. Thanks. --Sannita - not just another it.wiki sysop 15:09, 28 November 2019 (UTC)

  1. Example 1 : Use |bonus_header= and |show_bonus_points=. I reckon this is to blame for example 2  : local s_pts = tonumber(Args['adjust_points_'..team_code_ii]) or tonumber(Args['startpoints_'..team_code_ii]) or 0 : it will use adjust_points then startpoints then 0 rather than adding them together. If there are bonus points and penalties require separate columns then this will require a further change. I've added them to your tables as an example. Spike 'em (talk) 15:26, 28 November 2019 (UTC)
    Spike 'em, thank you for identifying the bug. I have fixed this part. I would support having a |show_start_points=yes to have a separate starting points column. first, we should probably get an idea of how many pages are using both adjust_points and startpoints to make sure there are no surprises (now tracking in category:Pages using sports table with both adjust and startpoints). Frietjes (talk) 15:38, 28 November 2019 (UTC)
  2. You can hide the played column using |hide_played=yes, which I think is what you want for Example 2. In each case |only_pld_pts=yes not only hides the data columns, but also the result. If another usage of this parameter is needed then it would need more code changes. As to setting the played column to what you need, then I'd add the required number to the losses (can even enter it as "3+2" if you know there are 3 actual losses and 2 missing games) Spike 'em (talk) 16:26, 28 November 2019 (UTC)
Note: it is possible to set the Pld column directly using |matches_ABC= but these are only used if at least one of |win_ABC= |draw_ABC= or |loss_ABC= are blank or non-numeric. It would require a code change (a new table param?) to use this value to override the sum of W+D+L, even if all values are set. Something like
if yesno(Args['override_matches'] or 'no') or tonumber(Args['win_'..team_code_ii]) == nil or tonumber(Args['draw_'..team_code_ii]) == nil or tonumber(Args['loss_'..team_code_ii]) == nil then
Spike 'em (talk) 16:54, 28 November 2019 (UTC)
I possibly have not understood correctly the situation, if so, correct me. Is the situation is that there are 10 played games, but we (the editors) know only results for 8 of them, then to manually set it to 10 played games but add data only for 8? If so, then maybe just add another param |unknown_results= or something and then it will count W+D+L+Unknown and add a note to played cell explaining that there are missing results for x amount of games; possibly also adding the page to a tracking category. --Gonnym (talk) 17:35, 28 November 2019 (UTC)
That is my understanding : we know the final games played and points totals, and some (but not all) of the individual results. I think on the given Example 1 we can work out the full WDL record for each team (ARS must have beaten SIR at home, and SIR drew one and lost one against SCL), but I guess that is beside the point. Spike 'em (talk) 10:11, 29 November 2019 (UTC)
@Spike 'em and Frietjes: thank you for your answers, and sorry for being this late in answering - other things took over, as always...
About the bonus/penalty/starting points, IMHO they should be treated as three different things, although I do not know how many cases there are of teams that get bonus points and penalty points. I think I found an example somewhere, but it's lost in my laptop's folder, and it might take a while to find it again.
About the |hide_played=, I did not know it existed, but it's interesting to know. :) TBH, I'd use |matches_ABC=, but in some way this should be used also when |win_ABC= |draw_ABC= or |loss_ABC= are not blank. Otherwise the |unknown_results= proposal is also good.
Thank you again for your help! --Sannita - not just another it.wiki sysop 16:31, 3 December 2019 (UTC)
we have Category:Pages using sports table with both adjust and startpoints to find pages using both adjust and start points. I don't see any articles in there, so we can definitely split the two without any problems. we will, however, need to be careful with any headers to make sure we don't mislabel anything. I don't entirely understand the need for |unknown_results_XYZ= since you can set the number of matches manually with |matches_XYZ=. yes, it is true that in order for that parameter to work you must have a non-numeric value in least one of the |win_XYZ=, |draw_XYZ=, and |loss_XYZ=. but, this makes sense since more than one of them must be unknown for the number of matches to be unknown. you simply put a ? or some marker after the value to have it considered as non-numeric (see this edit). I do see that the results column is always hidden if you have |only_pld_points=yes. I don't know the best user syntax for having all the Pld/W/D/L/GF/GA hidden but still having the points and results columns shown. come up with some good input syntax and I can certainly make it work in the module. Frietjes (talk) 17:30, 3 December 2019 (UTC)

Hiding GF&GA columns

I have a table where the source only gives information on GD but not on GF or GA: [1]. Is there a way I can hide the GF and GA columns and only display the GD column? Chanheigeorge (talk) 23:00, 4 January 2020 (UTC)

Chanheigeorge, okay, |hide_for_against_columns=y should work now. Frietjes (talk) 16:33, 5 January 2020 (UTC)

Hockey

Hi, I'm using the template for different sports and I noticed width is different for Ice Hockey and other sports, is there any specific reason ? I think they should be all the same.

Pos Team Pld W D L GF GA GD Pts
1  Cameroon 3 3 0 0 10 5 +5 9
Source: [citation needed]
Pos Team Pld W OTW OTL L GF GA GD Pts
1  Cameroon 3 3 0 0 0 22 7 +15 9
Source: [citation needed]

Mohsen1248 (talk) 13:26, 5 January 2020 (UTC)

They have different columns due to different rules about draws (or lack of them). Do you have any pages which mix usage of these tables that are experiencing problems? Spike 'em (talk) 14:51, 5 January 2020 (UTC)
in addition, sometimes there are different point multipliers assigned for OTW/OTL vs PKW/PKL. Frietjes (talk) 16:34, 5 January 2020 (UTC)
I still can't understand why for example the "pos" column should be different in those two tables. I didn't say why they have different columns, obviously I know they are different sports, I mean why column width is different. why hockey tables are wider ? Mohsen1248 (talk) 17:36, 5 January 2020 (UTC)
WDL has a standard column width of 28, whereas WDL OT (which WL OT invokes) has 32. Each of these has been the same since the modules were first created in 2014 / 2016 respectively. As to why this was done you'd have to ask the module creators (though it maybe that the 3 letter column headings are too wide to fit in the 28 pixel columns, so all the columns were widened so that they are constant within a given table?) Spike 'em (talk) 21:41, 5 January 2020 (UTC)
I can see the reason but if the whole idea of creating this Module:Sports table is to standardize all sport tables then it should be the same as others. I think maybe they can only keep those two columns at "32 pixel" or maybe even make it OW and OL instead of OWL and OTL. Mohsen1248 (talk) 11:29, 7 January 2020 (UTC)

Abbreviation issue

The right-hand side of the tables at the Group A section 2015 Ken Galluccio Cup use abbreviations that aren't written anywhere else in the article. Not sure why the usage is even warranted, as there is certainly enough space to write it out in full (as MOS:ABBR says Always consider whether it is better to simply write a word or phrase out in full, thus avoiding potential confusion for those not familiar with its abbreviation. Remember that Wikipedia does not have the same space constraints as paper.), but even if it's desired, the abbreviations should use {{abbr}} as the left-side of the table does - consistent and less confusion for everyone. --Gonnym (talk) 07:33, 1 February 2020 (UTC)

Volleyball

@McVahl, Mohsen1248, and Voncabriga: after some discussion on my talk page, I have added alternative syntax to Module:Sports table/Volleyball that is similar to the input format used in {{Vb cl9 team}}. Note that you probably only want to use on input style at a time, but if you do try to use more than one input style, the results should be additive. after my changes, the following should be roughly equivalent

Vb templates
{{Vb cl3 header}}
{{Vb cl9 team |p=1 |t={{vb|SRI}} |w3_0=3 |w3_1=0 |w3_2=0 |l2_3=0 |l1_3=0 |l0_3=0 |spw=225 |spl=158 |bc=#ccffcc}}
{{Vb cl9 team |p=2 |t={{vb|AUS}} |w3_0=0 |w3_1=1 |w3_2=1 |l2_3=0 |l1_3=0 |l0_3=1 |spw=256 |spl=269 |bc=#ccffcc}}
{{Vb cl9 team |p=3 |t={{vb|KSA}} |w3_0=0 |w3_1=1 |w3_2=0 |l2_3=0 |l1_3=1 |l0_3=1 |spw=243 |spl=254 |bc=#ffcccc}}
{{Vb cl9 team |p=4 |t={{vb|KAZ}} |w3_0=0 |w3_1=0 |w3_2=0 |l2_3=1 |l1_3=1 |l0_3=1 |spw=233 |spl=276 |bc=#ffcccc}}
{{end}}
Sports table
{{#invoke:Sports table|main|style=Volleyball
|team1=SRI|name_SRI={{vb|SRI}} |win3s_SRI=3 |win4s_SRI=0 |win5s_SRI=0 |loss5s_SRI=0 |loss4s_SRI=0 |loss3s_SRI=0 |spw_SRI=225 |spl_SRI=158 
|team2=AUS|name_AUS={{vb|AUS}} |win3s_AUS=0 |win4s_AUS=1 |win5s_AUS=1 |loss5s_AUS=0 |loss4s_AUS=0 |loss3s_AUS=1 |spw_AUS=256 |spl_AUS=269 
|team3=KSA|name_KSA={{vb|KSA}} |win3s_KSA=0 |win4s_KSA=1 |win5s_KSA=0 |loss5s_KSA=0 |loss4s_KSA=1 |loss3s_KSA=1 |spw_KSA=243 |spl_KSA=254 
|team4=KAZ|name_KAZ={{vb|KAZ}} |win3s_KAZ=0 |win4s_KAZ=0 |win5s_KAZ=0 |loss5s_KAZ=1 |loss4s_KAZ=1 |loss3s_KAZ=1 |spw_KAZ=233 |spl_KAZ=276 

|col_A=#ccffcc|result1=A|result2=A
|col_E=#ffcccc|result3=E|result4=E
}}

note that win3s means win in 3 sets, which is the same as w3_0 in the old vb templates. any win by more than one set is a "big win", and any loss by more than one set is a "big loss". the point values for big wins and big losses are the same as before and can be changed the same as before. let me know if you see any problems. Frietjes (talk) 21:14, 6 February 2020 (UTC)

Legs parameter from Module:Sports results

When the matches are defined in the template, would it be possible to support additional legs (for 3+ meetings in a season) as is done in Module:Sports results? For example here, so the results table doesn't have to be separate. S.A. Julio (talk) 23:15, 24 January 2020 (UTC)

Can't you use {{ThreeLegStart}}? It has an option to extend it to five legs. Howard the Duck (talk) 13:48, 25 January 2020 (UTC)
Doesn't really fit, as this isn't based on aggregate score or winning more matches than the other, but finishing first in a table based on points and goal difference. S.A. Julio (talk) 14:06, 25 January 2020 (UTC)
S.A. Julio, probably works now, but let me know if I didn't implement it correctly. Frietjes (talk) 19:27, 26 January 2020 (UTC)
Frietjes, great thanks! Only difference I noticed is the null value doesn't work for leg 3 (just displays a normal blank cell). S.A. Julio (talk) 03:11, 27 January 2020 (UTC)

S.A. Julio, I think you are talking about the difference in the match3_BBB_AAA cell (which is omitted and not set to null) seen here

Pos Team Pld W D L GF GA GD Pts AAA BBB AAA BBB AAA BBB
1 Team A 4 3 0 1 8 4 +4 9 0–1 3–1
2 Team B 4 1 0 3 4 8 −4 6 2–3 0–2 [a]
Source: the source
Rules for classification: 1) points; 2) head-to-head points; 3) head-to-head goal difference; 4) head-to-head goals scored; 5) goal difference; 6) number of goals scored.
Notes:
  1. ^ Match not played
Home \ Away AAA BBB AAA BBB AAA BBB
Team A 0–1 3–1
Team B 2–3 0–2 [a]
Updated to match(es) played on unknown. Source: [citation needed]
Legend: Blue = home team win; Yellow = draw; Red = away team win.
Notes:
  1. ^ Match not played

the interesting thing about this is that if you check the standard 1 leg case you see the same thing. the source of this difference can be found by checking the code for Module:Sports results line 184 which has Args[m..team_code_ii..'_'..team_code_jj] = (Args[m..team_code_ii..'_'..team_code_jj] or '–')..note_string which is default dash and Module:Sports table line 472 which has Args[m..team_code_ii..'_'..team_code_jj] = (Args[m..team_code_ii..'_'..team_code_jj] or '')..note_string which has default blank. another interesting feature is that if you were try to put a null in that cell you don't get what you would expect:

Pos Team Pld W D L GF GA GD Pts AAA BBB AAA BBB AAA BBB
1 Team A 4 3 0 1 8 4 +4 9 0–1 3–1
2 Team B 4 1 0 3 4 8 −4 6 2–3 0–2 null[a]
Source: the source
Rules for classification: 1) points; 2) head-to-head points; 3) head-to-head goal difference; 4) head-to-head goals scored; 5) goal difference; 6) number of goals scored.
Notes:
  1. ^ Match not played
Home \ Away AAA BBB AAA BBB AAA BBB
Team A 0–1 3–1
Team B 2–3 0–2 null[a]
Updated to match(es) played on unknown. Source: [citation needed]
Legend: Blue = home team win; Yellow = draw; Red = away team win.
Notes:
  1. ^ Match not played

unless you remove the note from the result. editors have probably figured this out by now. as far as the inconsistency goes, I am all for making them consistent. if possible, I would like to merge more of the redundant code which would force them to be consistent. the main question is: should the default be dash or should the default be blank? I really don't care either way. Frietjes (talk) 16:16, 27 January 2020 (UTC)

Frietjes, thanks a lot for adding the legs functionality to this module. I have tried to add it to the Dutch version as well but weirdly it doesn't work there. nl:Sjabloon:Stand Play-off 3 (voetbal België) is one of the instance where its use is desired there. Could you take a look?Tvx1 21:18, 22 February 2020 (UTC)
Tvx1, okay, I think I fixed it. there is a lot there, but you had missed making changes to the header and row subfunctions in nl:Module:Sports results. now that I have implemented the changes there, it should be working (although I may have missed something). Frietjes (talk) 14:45, 23 February 2020 (UTC)

I've been thinking about this a bit more and I'm starting to wonder why these legs are always generated in pairs (e.g. 2/4/6). In the above example, for instance, I'd think that the sixth column of matches doesn't really need to be there.Tvx1 22:39, 29 February 2020 (UTC)

Head to head column

I have been using the WDL template. In sports that frequently have multiple teams/players tied, it might be more useful to have a separate column for HTH rather than attaching notes to the points column. A hacky way that I have done this is to use

|rw_header=<abbr title="head-to-head score among tied players">HTH</abbr>
|show_rw=yes
|rwpoints=0

with |rw_NAME=1 (or however many points NAME had among tied teams/players)

This runs into problems though, especially if |rwpoints=0 gets removed in someone else's edit.

Is there a way someone could make an option for a hth column that appears right after the points column? Thanks!

The main reason I want one is for Chess tournaments. There is a Chess version of Sports table, but I'm not sure how it works exactly. At least, you can't just convert a WDL table into one, which would be kinda necessary. NHammen (talk) 13:49, 23 March 2020 (UTC)


I decided to make one in the sandbox for WDL myself. Testing testing:

Rank Player Pts Pld W D L SB NEP MVL CAR GIR WAN GRI DIN ALE
1  Ian Nepomniachtchi (RUS) 4.5 6 3 3 0 12      ½    1   1    ½    1     ½ 
2  Maxime Vachier-Lagrave (FRA) 3.5 6 1 5 0 9     ½     ½    ½   ½    1     ½ 
3  Fabiano Caruana (USA) 3 6 1 4 1 9  ½     ½    ½       ½    0   1  
4–5  Anish Giri (NED) 3 6 1 4 1 7.75  0    ½    ½     ½       ½    1 
4–5  Wang Hao (CHN) 3 6 1 4 1 7.75   0   ½       ½     ½    1   ½  
6  Alexander Grischuk (RUS) 3 6 0 6 0 9   ½    ½   ½       ½    ½    ½  
7  Ding Liren (CHN) 2 6 1 2 3 6   0    0   1    ½    0     ½    
8  Kirill Alekseenko (RUS) 2 6 0 4 2 7  ½    ½      0   0     ½    ½    
Updated to match(es) played on 23 March 2020. Source: Official website
Rules for classification: 1) points; 2) head-to-head score among tied players; 3) total number of wins; 4) Sonneborn–Berger score (SB); 5) tie-break games.

Note: Numbers in the crosstable in a white background indicate the result playing the respective opponent with the white pieces (black pieces if on a black background).


Seems to work. How does this get moved from sandbox to main? NHammen (talk) 20:16, 23 March 2020 (UTC)

Nevermind. I got the Chess module table to work. So I don't need this to migrate from sandbox anymore. NHammen (talk) 00:31, 5 April 2020 (UTC)

Chess style match table

@Frietjes: In the chess style, I would like to make the match table look like the match table from the 2014 candidates tournament (copied below). However, the match table is called from Sports table main, not from the Chess style, so an alteration would have to be made to Sports table main. Would it be acceptable to make a copy of Module:Sports_results called Module:Sports_results/Chess which would only include the necessary functions (header and row I think) so that we could reverse the order of the team and leg loops in that module? In Sports table we would also need to add a line of code after local p_matches = match_table and require('Module:Sports results') that says if style_def == 'Chess' then local p_matches = match_table and require('Module:Sports results/Chess') end. Is that too hacky?

Alternatively, we could add an option in Sports results which flips the order of the team and leg loops, but that would involve duplicating a lot of code in ways that it is easy to break things.

Anyways, I would like the match crosstable to end up looking something like this:

Final standings of the 2014 Candidates Tournament
Rank Player Rating
March 2014
1
(VA)
2
(SK)
3
(VK)
4
(SM)
5
(DA)
6
(LA)
7
(PS)
8
(VT)
Points Tiebreaks
H2H Wins SB
W B W B W B W B W B W B W B W B
1 India Viswanathan Anand 2770 ½ ½ ½ ½ ½ 1 ½ ½ 1 ½ ½ ½ 1 ½ 3 57.25
2 Russia Sergey Karjakin 2766 ½ ½ 1 0 ½ ½ ½ ½ 0 1 ½ 1 ½ ½ 3 51.75
3 Russia Vladimir Kramnik 2787 ½ ½ 1 0 1 ½ ½ ½ ½ ½ 0 ½ 1 0 7 3 49.25
4 Azerbaijan Shakhriyar Mamedyarov 2757 0 ½ ½ ½ ½ 0 1 ½ 1 0 1 ½ ½ ½ 7 2 3 48.00
5 Russia Dmitry Andreikin 2709 ½ ½ ½ ½ ½ ½ ½ 0 1 ½ ½ 0 1 ½ 7 2 48.50
6 Armenia Levon Aronian 2830 ½ 0 0 1 ½ ½ 1 0 ½ 0 1 ½ ½ ½ 3 45.00
7 Russia Peter Svidler 2758 ½ ½ 0 ½ ½ 1 ½ 0 1 ½ ½ 0 1 0 ½ 3 46.00
8 Bulgaria Veselin Topalov 2785 ½ 0 ½ ½ 1 0 ½ ½ ½ 0 ½ ½ 1 0 6 2 42.25

NHammen (talk) 20:49, 5 April 2020 (UTC)

@Frietjes: @CaradhrasAiguo: @Adpete: I built a Module:Sports results/Chess , and now I have some code in the sandbox. Here is the result:

Rank Player Rating
March 2014
Score H2H Wins SB Qualification VA SK VK SM DA LA PS VT
1  Viswanathan Anand (IND) (Q) 2770 8 12 3 57.25 Advance to title match ½ ½ ½ ½ ½ 1 ½ ½ 1 ½ ½ ½ 1 ½
2  Sergey Karjakin (RUS) 2766 7 12 3 51.75 ½ ½ 1 0 ½ ½ ½ ½ 0 1 ½ 1 ½ ½
3  Vladimir Kramnik (RUS) 2787 7 2 12 3 49.25 ½ ½ 1 0 1 ½ ½ ½ ½ ½ 0 ½ 1 0
4  Shakhriyar Mamedyarov (AZE) 2757 7 2 3 48 0 ½ ½ ½ ½ 0 1 ½ 1 0 1 ½ ½ ½
5  Dmitry Andreikin (RUS) 2709 7 1 12 2 48.5 ½ ½ ½ ½ ½ ½ ½ 0 1 ½ ½ 0 1 ½
6  Levon Aronian (ARM) 2830 6 12 1 12 3 45 ½ 0 0 1 ½ ½ 1 0 ½ 0 1 ½ ½ ½
7  Peter Svidler (RUS) 2758 6 12  12 3 46 ½ ½ 0 ½ ½ 1 ½ 0 1 ½ ½ 0 1 0
8  Veselin Topalov (BUL) 2785 6 2 42.25 ½ 0 ½ ½ 1 0 ½ ½ ½ 0 ½ ½ 1 0
Source: [2]
(Q) Qualified to the phase indicated

For this to work, now all that needs to be done is that the 3 lines of code from Module:Sports table/sandbox need to be ported to the main Module:Sports table NHammen (talk) 01:02, 7 April 2020 (UTC)

You seem to have changed a lot more than 3 lines, is it just the section at the top that you need changing? Spike 'em (talk) 09:12, 7 April 2020 (UTC)
@Spike 'em: The diff (https://en.wikipedia.org/w/index.php?title=Special%3AComparePages&page1=Module%3ASports+table&page2=Module%3ASports+table%2Fsandbox) between the current Sports table and the Sports table/sandbox has five lines of code that are different. Two of those differences are just using the sandbox versions of other modules, which have no differences from their main. The other three lines of code are the lines that I added. NHammen (talk) 13:11, 7 April 2020 (UTC)
Ah, apologies: I was just diffing the recent changes you made to the sandbox, some of which was just getting that in-line with the main page. Spike 'em (talk) 14:02, 7 April 2020 (UTC)
No need to apologize. That's entirely understandable. NHammen (talk) 15:45, 7 April 2020 (UTC)
NHammen, I made this change which should be effectively what you had, but without the extra require. if we have a situation where there are more sports that have custom results tables, we can always refactor the code to use the equivalent of a "switch" statement there. hopefully I didn't break anything. the main reason why I stopped working on the chess submodule was lack of interest from the community. it seems like you will have more luck than I did. Frietjes (talk) 15:45, 8 April 2020 (UTC)
Frietjes, thank you. That works great! NHammen (talk) 17:51, 8 April 2020 (UTC)