Content deleted Content added
m Archiving 1 discussion(s) from Module talk:Sports table) (bot |
m Archiving 1 discussion(s) from Module talk:Sports table) (bot |
||
Line 338:
:Nevermind. I got the Chess module table to work. So I don't need this to migrate from sandbox anymore. [[User:NHammen|NHammen]] ([[User talk:NHammen|talk]]) 00:31, 5 April 2020 (UTC)
== Chess style match table ==
{{Ping|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
<code>local p_matches = match_table and require('Module:Sports results')</code>
that says
<code>if style_def == 'Chess' then local p_matches = match_table and require('Module:Sports results/Chess') end</code>.
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:
:{| class="wikitable"
|+ Final standings of the 2014 Candidates Tournament
|-
!rowspan="2"|Rank!!rowspan="2" width="250px"|Player !!rowspan="2"|Rating<br/><small>March 2014</small>
!colspan="2" rowspan="2" |1<br/> ({{Abbr|VA|Viswanathan Anand}})
!colspan="2" rowspan="2" |2<br/> ({{Abbr|SK|Sergey Karjakin}})
!colspan="2" rowspan="2" |3<br/> ({{Abbr|VK|Vladimir Kramnik}})
!colspan="2" rowspan="2" |4<br/> ({{Abbr|SM|Shakhriyar Mamedyarov}})
!colspan="2" rowspan="2" |5<br/> ({{Abbr|DA|Dmitry Andreikin}})
!colspan="2" rowspan="2" |6<br/> ({{Abbr|LA|Levon Aronian}})
!colspan="2" rowspan="2" |7<br/> ({{Abbr|PS|Peter Svidler}})
!colspan="2" rowspan="2" |8<br/> ({{Abbr|VT|Veselin Topalov}})
!rowspan="2"|Points !! colspan=3|Tiebreaks
|-
! {{Abbr|H2H|Head-to-Head}} !! Wins !! {{Abbr|[[Sonneborn-Berger score|SB]]|Sonneborn-Berger score}}
|-
!colspan=3|
!width="13px"|W
!width="13px"|B
!width="13px"|W
!width="13px"|B
!width="13px"|W
!width="13px"|B
!width="13px"|W
!width="13px"|B
!width="13px"|W
!width="13px"|B
!width="13px"|W
!width="13px"|B
!width="13px"|W
!width="13px"|B
!width="13px"|W
!width="13px"|B
!colspan=4|
|-
|- align="center" style="background:white; color:black"
|style="background:#ccffcc;"|1||align="left" style="background:#ccffcc;"|{{flagicon|IND}} [[Viswanathan Anand]]
| style="background:#ccffcc;"|2770
|style="background:lightgray" colspan="2"|
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|1
|½||style="background:black; color:white"|½
|1||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|1||style="background:black; color:white"|½
|style="background:#ccffcc;"|8½ || style="background:#ccffcc;"|—|| style="background:#ccffcc;" |3|| style="background:#ccffcc;"| 57.25
|- align="center" style="background:white; color:black"
|2||align="left"|{{flagicon|RUS}} [[Sergey Karjakin]]
|2766
|½||style="background:black; color:white"|½
|style="background:lightgray" colspan="2"|
|1||style="background:black; color:white"|0
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|0||style="background:black; color:white"|1
|½||style="background:black; color:white"|1
|½||style="background:black; color:white"|½
|7½||—
|3||51.75
|- align="center" style="background:white; color:black"
|3|| align="left" |{{flagicon|RUS}} [[Vladimir Kramnik]]
|2787
|½||style="background:black; color:white"|½
|1||style="background:black; color:white"|0
|style="background:lightgray" colspan="2"|
|1||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|0||style="background:black; color:white"|½
|1||style="background:black; color:white"|0
|7||2½
|3||49.25
|- align="center" style="background:white; color:black"
|4||align="left"|{{flagicon|AZE}} [[Shakhriyar Mamedyarov]]
|2757
|0||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|0
|style="background:lightgray" colspan="2"|
|1||style="background:black; color:white"|½
|1||style="background:black; color:white"|0
|1||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|7||2
|3||48.00
|- align="center" style="background:white; color:black"
|5||align="left"|{{flagicon|RUS}} [[Dmitry Andreikin]]
|2709
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|0
|style="background:lightgray" colspan="2"|
|1||style="background:black; color:white"|½
|½||style="background:black; color:white"|0
|1||style="background:black; color:white"|½
|7||1½||2||48.50
|- align="center" style="background:white; color:black"
|6||align="left"|{{flagicon|ARM}} [[Levon Aronian]]
|2830
|½||style="background:black; color:white"|0
|0||style="background:black; color:white"|1
|½||style="background:black; color:white"|½
|1||style="background:black; color:white"|0
|½||style="background:black; color:white"|0
|style="background:lightgray" colspan="2"|
|1||style="background:black; color:white"|½
|½||style="background:black; color:white"|½
|6½||1½||3||45.00
|- align="center" style="background:white; color:black"
|7||align="left"|{{flagicon|RUS}} [[Peter Svidler]]
|2758
|½||style="background:black; color:white"|½
|0||style="background:black; color:white"|½
|½||style="background:black; color:white"|1
|½||style="background:black; color:white"|0
|1||style="background:black; color:white"|½
|½||style="background:black; color:white"|0
|style="background:lightgray" colspan="2"|
|1||style="background:black; color:white"|0
|6½||½||3||46.00
|- align="center" style="background:white; color:black"
|8||align="left"|{{flagicon|BUL}} [[Veselin Topalov]]
|2785
|½||style="background:black; color:white"|0
|½||style="background:black; color:white"|½
|1||style="background:black; color:white"|0
|½||style="background:black; color:white"|½
|½||style="background:black; color:white"|0
|½||style="background:black; color:white"|½
|1||style="background:black; color:white"|0
|style="background:lightgray" colspan="2"|
|6||—||2||42.25
|}
[[User:NHammen|NHammen]] ([[User talk:NHammen|talk]]) 20:49, 5 April 2020 (UTC)
{{Ping|Frietjes}} {{Ping|CaradhrasAiguo}} {{Ping|Adpete}} I built a Module:Sports results/Chess , and now I have some code in the sandbox. Here is the result:
{{#invoke:Sports table|main|style=Chess
|source=[http://candidates2014.fide.com/pairings-and-results/]
|postitle = Rank
|winpoints=1
|drawpoints=0.5
|losspoints=0
|hide_played=yes
|show_rating=yes
|rate_date=March 2014
|show_sb=yes
|disp_fractions=yes
|show_matches=true
|solid_cell=grey
|update=complete
|res_col_header=Q
|result1=WC
|col_WC=green1 |text_WC={{nowrap|Advance to [[World Chess Championship 2014#Championship match|title match]]}}
|team1=ANA |team2=KAR |team3=KRA |team4=MAM |team5=AND |team6=ARO |team7=SVI |team8=TOP
|status_ANA=Q
|team_header=Player
|name_ANA={{flagathlete|[[Viswanathan Anand]]|IND}} |short_ANA={{Abbr|VA|Viswanathan Anand}} |rating_ANA=2770
|name_AND={{flagathlete|[[Dmitry Andreikin]]|RUS}} |short_AND={{Abbr|DA|Dmitry Andreikin}} |rating_AND=2709
|name_ARO={{flagathlete|[[Levon Aronian]]|ARM}} | short_ARO={{Abbr|LA|Levon Aronian}} |rating_ARO=2830
|name_KAR={{flagathlete|[[Sergey Karjakin]]|RUS}} |short_KAR={{Abbr|SK|Sergey Karjakin}} |rating_KAR=2766
|name_KRA={{flagathlete|[[Vladimir Kramnik]]|RUS}} |short_KRA={{Abbr|VK|Vladimir Kramnik}} |rating_KRA=2787
|name_MAM={{flagathlete|[[Shakhriyar Mamedyarov]]|AZE}} |short_MAM={{Abbr|SM|Shakhriyar Mamedyarov}} |rating_MAM=2757
|name_SVI={{flagathlete|[[Peter Svidler]]|RUS}} | short_SVI={{Abbr|PS|Peter Svidler}} |rating_SVI=2758
|name_TOP={{flagathlete|[[Veselin Topalov]]|BUL}} |short_TOP={{Abbr|VT|Veselin Topalov}} |rating_TOP=2785
|match_ANA_KAR=½+½
|match_ANA_KRA=½+½
|match_ANA_MAM=½+1
|match_ANA_AND=½+½
|match_ANA_ARO=1+½
|match_ANA_SVI=½+½
|match_ANA_TOP=1+½
|match_KAR_ANA=½+½
|match_KAR_KRA=1+0
|match_KAR_MAM=½+½
|match_KAR_AND=½+½
|match_KAR_ARO=0+1
|match_KAR_SVI=½+1
|match_KAR_TOP=½+½
|match_KRA_ANA=½+½
|match_KRA_KAR=1+0
|match_KRA_MAM=1+½
|match_KRA_AND=½+½
|match_KRA_ARO=½+½
|match_KRA_SVI=0+½
|match_KRA_TOP=1+0
|hth_KRA = 2½
|match_MAM_ANA=0+½
|match_MAM_KAR=½+½
|match_MAM_KRA=½+0
|match_MAM_AND=1+½
|match_MAM_ARO=1+0
|match_MAM_SVI=1+½
|match_MAM_TOP=½+½
|hth_MAM = 2
|match_AND_ANA=½+½
|match_AND_KAR=½+½
|match_AND_KRA=½+½
|match_AND_MAM=½+0
|match_AND_ARO=1+½
|match_AND_SVI=½+0
|match_AND_TOP=1+½
|hth_AND = 1½
|match_ARO_ANA=½+0
|match_ARO_KAR=0+1
|match_ARO_KRA=½+½
|match_ARO_MAM=1+0
|match_ARO_AND=½+0
|match_ARO_SVI=1+½
|match_ARO_TOP=½+½
|hth_ARO = 1½
|match_SVI_ANA=½+½
|match_SVI_KAR=0+½
|match_SVI_KRA=½+1
|match_SVI_MAM=½+0
|match_SVI_AND=1+½
|match_SVI_ARO=½+0
|match_SVI_TOP=1+0
|hth_SVI = ½
|match_TOP_ANA=½+0
|match_TOP_KAR=½+½
|match_TOP_KRA=1+0
|match_TOP_MAM=½+½
|match_TOP_AND=½+0
|match_TOP_ARO=½+½
|match_TOP_SVI=1+0
}}
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 [[User:NHammen|NHammen]] ([[User talk: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? [[User:Spike 'em|Spike 'em]] ([[User talk:Spike 'em|talk]]) 09:12, 7 April 2020 (UTC)
::{{Ping|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. [[User:NHammen|NHammen]] ([[User talk: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. [[User:Spike 'em|Spike 'em]] ([[User talk:Spike 'em|talk]]) 14:02, 7 April 2020 (UTC)
::::No need to apologize. That's entirely understandable. [[User:NHammen|NHammen]] ([[User talk:NHammen|talk]]) 15:45, 7 April 2020 (UTC)
::::: [[User:NHammen|NHammen]], I made [//en.wikipedia.org/w/index.php?title=Module%3ASports_table&type=revision&diff=949795564&oldid=941992646 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. [[User:Frietjes|Frietjes]] ([[User talk:Frietjes|talk]]) 15:45, 8 April 2020 (UTC)
:::::: [[User:Frietjes|Frietjes]], thank you. That works great! [[User:NHammen|NHammen]] ([[User talk:NHammen|talk]]) 17:51, 8 April 2020 (UTC)
|