Module talk:Team bracket

(Redirected from Module talk:Team bracket/sandbox)
Latest comment: 3 months ago by Jonesey95 in topic Edit request 14 August 2024

Use for tennis?

edit

Could this module be used for tennis templates, such as {{8TeamBracket-Tennis3}}? There are 3 score cells and teams can be one line for singles or two lines for doubles. See Template:8TeamBracket-Tennis3/testcases for examples. —PC-XT+ 18:39, 5 March 2015 (UTC)Reply

@PC-XT: I did make Module:TeamBracket-Compact-Tennis but ran into objections from one user upon deployment. So I gave up. See Template talk:16TeamBracket-Compact-Tennis3#Convert to lua version. --SocietyBox (talk) 13:14, 6 March 2015 (UTC)Reply
Thanks. I'll see if I can get some discussion at WT:TENNIS#What do you think of Lua modules? before I try a conversion. —PC-XT+ 20:10, 6 March 2015 (UTC)Reply

Suggestions

edit

Maybe some colors can be added? For example, to implement this template. --Edgars2007 (talk/contribs) 18:15, 5 April 2015 (UTC)Reply

@SocietyBox: and what about 3rd place? For example, for this one. If it helps, RoundN module has 3rd place option (ctrl+F: By default, |3rdplace= is set to 'yes' when) --Edgars2007 (talk/contribs) 08:16, 15 May 2015 (UTC)Reply

Modifying numbers

edit

Presently the 4 round variants (and above) allow for the modification of the seeds to show the higher seeded team on the top of each pairing. Is it possible to do the same on the 2 and 3 round versions. –Z.I. Barbour (talk) 04:01, 17 December 2017 (UTC)Reply

Feature request: more matches per round and third place match

edit

Looking at the sea of templates at Category:8-Team bracket templates, it seems the reason for the mass creations of essentially forks, is that some brackets need 2 features: more matches per round and an option to add a third place match. If this will be added to the module, it will allow converting dozens of other templates. Is this something that can be added to this? --Gonnym (talk) 11:03, 13 June 2019 (UTC)Reply

Gonnym, Module:TeamBracket-Tennis has both of these features. my hope is to merge these modules into one, or at the very least, port some of the features from Module:TeamBracket-Tennis to this module. Frietjes (talk) 16:30, 13 June 2019 (UTC)Reply
Ah, now I see that some of those templates are calling that module (the template doc didn't say that and didn't check the code before). It totally makes sense for those two modules to be merged. --Gonnym (talk) 16:49, 13 June 2019 (UTC)Reply
Gonnym, I will work on merging them. the only differences are (1) the width of the lines dividing the score and team names, (2) automatic generation of the seeds for the first round, (3) the default number of sets/legs. I plan to (1) make the width of the dividing lines an option, (2) make the automatic seed generation an option, (3) make the default number of sets/legs an option. as a transition, I can probably make the tennis module a frontend for this module that just sets these two parameters and calls this module. Frietjes (talk) 16:55, 13 June 2019 (UTC)Reply
That's a great plan. I haven't researched this fully yet, but from my experience with the wiki, I would guess that anything related to widths are just subjective personal tastes of a few editors and then copy/paste from everyone else. These, like other merges, would be much better served with a consistent look and feel. Regarding the number of sets/legs, those can be handled either through generalized templates or just adding manually that code. Not sure I can see the value in leaving the Tennis one, as it has various layouts itself which at least some aren't unique to it - but we will be smarter once a merge is done, so no need to jump the gun on that. Unrelated, but a related thing to look into, and I'm not sure how best to deal with, the boxes aren't really accessibility compliant as there aren't any headers for the cells. A simple solution would just add that to each box, but that would duplicate it visually and would probably draw complains from editors. No idea how to do it otherwise. --Gonnym (talk) 17:20, 13 June 2019 (UTC)Reply
I have switched this template over to use new backend code as part of the code merger with the Tennis template, and for supporting legs/byes/etc. there should be no significant changes in appearance/functionality. please let me know if you see any problems so I can fix any bugs. thank you. Frietjes (talk) 17:28, 9 February 2021 (UTC)Reply

3TeamBracket

edit

Frietjes, great work with this module. I converted Template:3TeamBracket to use it and it is generally working great, but there is more padding between the headings and the tree than there was in the pre-lua version. Would it be possible to have the module detect when these rows are blank and eliminate them? Thanks! Plastikspork ―Œ(talk) 19:01, 13 February 2021 (UTC)Reply

possible, but will probably require two passes, which is painful. I will work on it. Frietjes (talk) 17:40, 16 February 2021 (UTC)Reply
Plastikspork, okay, now implemented. it was a fairly extensive change, so hopefully nothing broke. I tested the main features in the testscases. Frietjes (talk) 16:24, 10 April 2021 (UTC)Reply
Thanks! Looks great! Plastikspork ―Œ(talk) 17:39, 10 April 2021 (UTC)Reply

script errors

edit

@ Frietjes: A recent change is causing script errors. See 2009 SaskTel Tankard, 2012 Alberta Scotties Tournament of Hearts, 2015 PEI Tankard, 2019 Newfoundland and Labrador Tankard for examples.

Trappist the monk (talk) 20:45, 10 April 2021 (UTC)Reply

The problem appears in function renderThird(count) where, in the for loop, row = rows[k] can be nil. By the way, function getSeeds() should have local. Johnuniq (talk) 02:21, 11 April 2021 (UTC)Reply
yes, thank you, was using the wrong formula for compute the rows for third. Frietjes (talk) 14:34, 11 April 2021 (UTC)Reply

@Frietjes: 2009–10 HockeyAllsvenskan season is showing Lua error: bad argument #1 to 'gsub' (string expected, got boolean) in function scoreCompare. That is due to the following code in Module:Team bracket.

if agg and aggregate ~= '' and score1 == nil and hassum then
    score1 = (aggregate == 'score') and sumscore
        or (aggregate == 'legs' or aggregate == 'sets' and wins)
        or nil
end

The error occurs when aggregate is 'legs' which makes aggregate == 'legs' evaluate as true and that is the value assigned to score1. Line 369 has the form (a or b and c) which means (a or (b and c)) so if a is true, that is the result of the expression. I was investigating in the hope of finding a simple way for the error message to show which entry in the table is causing the problem. I've seen similar messages a few times and the fix was simple, but finding the mistake in the article wikitext was difficult. Maybe you can better work out what the logic should be so score1 is never a boolean. Johnuniq (talk) 09:38, 23 April 2021 (UTC)Reply

Johnuniq, should be fixed now, I forgot the () as you indicated. thank you. Frietjes (talk) 22:26, 23 April 2021 (UTC)Reply

Groups with compact

edit

@Frietjes: Would it be possible to enable groups with compact? I imagine we probably can't fit them in for Round 1, but it looks like there is room for Round 2 and higher. This would help tighten Template:10TeamBracketReSeed. Thanks! Plastikspork ―Œ(talk) 14:36, 7 May 2021 (UTC)Reply

Plastikspork, this should basically work now. at some point I would like to add round 1 when half the pair is omitted, and make the groups have a wider colspan when possible, but I think it looks okay for now. Frietjes (talk) 16:20, 7 May 2021 (UTC)Reply

boldwinner doesn't work on PK scores

edit

When boldwinner = yes, the templates do not bold the winner of a match that goes to penalty kicks (e.g. score = 2 (5)). The game is presumed a tie. For an example of where this fails, see 2002 FIFA World Cup qualification (CONCACAF). This feature works in Module:RoundN. –Aidan721 (talk) 00:27, 11 May 2021 (UTC)Reply

Aidan721, should work now. Frietjes (talk) 15:48, 1 June 2021 (UTC)Reply

boldwinner change

edit

In case of boldwinner = high and aggregate = legs, highlight winner only if wins > (legs/2). Applies to otherwins too. Deancarmeli (talk) 09:00, 1 June 2021 (UTC)Reply

okay, now changed. Frietjes (talk) 15:41, 1 June 2021 (UTC)Reply
@Frietjes: The team name is still highlighted when the series isn't yet settled. Deancarmeli (talk) 19:50, 1 June 2021 (UTC)Reply
Deancarmeli, you need to provide a link to an example. Frietjes (talk) 20:15, 1 June 2021 (UTC)Reply
@Frietjes: The example. Deancarmeli (talk) 20:58, 1 June 2021 (UTC)Reply
Deancarmeli, looks fine, may have been a caching issue. Frietjes (talk) 20:59, 1 June 2021 (UTC)Reply

Weird width bug on hideomitted scores

edit

Please see 2021 PDC World Cup of Darts#Draw. When Hideomittedscores is activated, the round 2 first scores display with a larger width than the rest. @Frietjes: any ideas? DLManiac (talk) 06:51, 13 September 2021 (UTC)Reply

DLManiac, do you see the same thing when you make your browser window large enough that the bracket isn't touching the right edge of the page? the column spacing is set by a blank row between the top headings and the bracket. for this particular example, the code for that spacer row looks like this:
<tr><td style="width:1px"></td>
<td style="width:20px">&nbsp;</td><td style="width:170px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:5px"></td><td style="width:5px"></td>
<td style="width:20px">&nbsp;</td><td style="width:170px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:5px"></td><td style="width:5px"></td>
<td style="width:20px">&nbsp;</td><td style="width:170px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:5px"></td><td style="width:5px"></td>
<td style="width:20px">&nbsp;</td><td style="width:170px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:5px"></td><td style="width:5px"></td>
<td style="width:20px">&nbsp;</td><td style="width:170px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:25px">&nbsp;</td><td style="width:1px"></td>
</tr>
The first 1px column is the left edge of the bracket. this column is followed by a 20px column for the 1st round seed, 170px column for the 1st round teams, and a 25px columns for the first round scores. The next two 5px columns are for the lines that connect the first round to the second round. this pattern then repeats for the second, third, fourth rounds. so, the score columns are all set to be 25px wide. if your browser window isn't large enough to fit the table (i.e., 1px + 20px + 170px + 25px + 5px + 5px + ... + 25px + 25px + 1px = 1467px) then your web browser has to decide what to do. in many cases, the browser uses an algorithm to reduce the widths of these columns to try to make the bracket fit in the browser window. the algorithm frequently generates uneven columns as a result (i.e., not all the 25px columns are reduced by the same amount). I could add a width to the outer table, which would probably prevent your browser from trying to compress the table, but you would then have scroll bars to see the part of the table that doesn't fit in the window. Frietjes (talk) 14:40, 13 September 2021 (UTC)Reply
Yes, they all display full width if I zoom out. I guess I was just thinking that somehow the "auto resize to fit" feature should be applied equally across all the score columns. DLManiac (talk) 18:22, 13 September 2021 (UTC)Reply
Additionally, setting "score-width=auto" makes that extra column very strange. This feels more like a bug...DLManiac (talk) 18:28, 13 September 2021 (UTC)Reply
Final update - I set score-width=1.5% and this seemed to be a good fix across all window sizesDLManiac (talk) 18:38, 13 September 2021 (UTC)Reply

Again on Boldwinner

edit

Hello, I imported the module as is on it.wp, but it doesn't show the winner in bold always when there are more than two legs involved: see it:Coppa dei Campioni 1963-1964 and it:Federal Hockey League 2013-2014 for example. What can be the problem here? Sannita - not just another it.wiki sysop 21:37, 2 November 2021 (UTC)Reply

Both of those examples are rendering properly in my browser. DLManiac (talk) 22:02, 2 November 2021 (UTC)Reply
I'm not referring to the scores, those work. I'm referring to the teams: see Jeunesse Esch or Górnik Zabrze in the first round in "Coppa dei Campioni 1963-1964". They should be bold, but they're not. Sannita - not just another it.wiki sysop 22:10, 2 November 2021 (UTC)Reply
Sorry - did not see that DLManiac (talk) 01:01, 3 November 2021 (UTC)Reply
Sannita, looks like a bug checking the example in the documentation. I will fix it in a moment. Frietjes (talk) 15:06, 3 November 2021 (UTC)Reply
now fixed, but that section of code really needs some clean up to make it less confusing. Frietjes (talk) 15:37, 3 November 2021 (UTC)Reply
@Frietjes Thank you very much! Sannita - not just another it.wiki sysop 18:35, 3 November 2021 (UTC)Reply

Fifth-place match?

edit

Is there any way that support for a fifth-place match could be added to this module? For example similar to Template:7TeamBracket-WC-with-5th. S.A. Julio (talk) 17:18, 29 November 2021 (UTC)Reply

possible, but would require some work since the location of the 5th place match is on top of where a first round match would normally appear. I will look into it. Frietjes (talk) 14:42, 6 June 2022 (UTC)Reply

A bug

edit

See 2022_AFC_Champions_League_knockout_stage#Bracket, I did not write any score there, but final agg still display 0. Hhkohh (talk) 03:12, 20 April 2022 (UTC)Reply

fixed, hopefully the fix didn't introduce a new bug. Frietjes (talk) 14:40, 6 June 2022 (UTC)Reply

Feature request: headers for double-elimination brackets

edit

I don't know how feasible this would be, but is there any way to add another row of headers for double-elimination brackets? As an example, the current 4-team DE bracket that uses this module is {{4TeamBracket-2Elim}}. Frankly, I find that the way it looks is a bit confusing for readers; it looks like an odd 6 or 7 team single elimination bracket. It would be nice if there was a way to make it look like {{4Team2ElimBracketExceptFinal}}, where the lower bracket had a clear divider. I think being able to add a header row that evenly divides the number of games in the first round would be sufficient. For example, for a 6-team DE bracket ({{6TeamBracket-2Elim}}), we would use 4 rounds, and the "DE parameter" would add a header after the Round 1 7/8 match, Round 2 3/4 match, and Round 3 1/2 match. – Pbrks (t • c) 15:08, 18 May 2022 (UTC)Reply

should be possible, but it will require some work since it requires changing the spacing between the matches. I will look into it. Frietjes (talk) 14:42, 6 June 2022 (UTC)Reply

Bug report: third place match and legs

edit

There is a bug involving legs and alignment when there are third place matches, such as the following example:

{{6TeamBracket
| legs = 2/1/1
| RD3b = Third place
}}
Quarterfinals Semifinals Finals
1  
4    
5    
 
2  
3    
6   Third place
 
 

Some leg combinations have the same issue, such as |legs=1/2/1 and |legs=1/2/2, while others work fine, such as |legs=2/2/1 and |legs=1/1/2 – Pbrks (t • c) 02:36, 27 July 2022 (UTC)Reply

Pbrks, should be fixed now, but I haven't tested cases with more than three rounds. Frietjes (talk) 16:40, 23 August 2022 (UTC)Reply

Seeding and Header bugs

edit

I was using the 13 team bracket and noticed a bug where the incorrect seed is displayed in the quarterfinals. Whatever seed is set by |RD3-seed3= is also being used by the |RD3-seed5= and |RD3-seed7= fields. An example of this can be seen in 2016 Conference USA Men's Basketball Tournament#Bracket where Charlotte and UTEP are not using the seeds they were assigned, but instead are using the seed assigned to Old Dominion. In addition, the header that is set for the first round is overriding the second round, so the first round header is being displayed twice. @Frietjes
Zachlp (talk) 15:06, 23 August 2022 (UTC)Reply

@Zachlp: The issue was not with Module:Team bracket, just some incorrect parameter names in Template:13TeamBracket-Basketball itself. Fixed. – Pbrks (t • c) 15:24, 23 August 2022 (UTC)Reply
Thank you! Zachlp (talk) 15:27, 23 August 2022 (UTC)Reply

Option to not bold text in parentheses?

edit

@Frietjes: Is there any way that text inside brackets/parentheses of the team parameters could not be bolded in this module (and Module:RoundN) when |boldwinner=high is set? For example at Football at the 1920 Summer Olympics#Original bracket, is there any way that for the Netherlands vs. Sweden match, only "Netherlands" is bolded, and not "(a.e.t.)"? Thanks, S.A. Julio (talk) 20:40, 20 December 2022 (UTC)Reply

S.A. Julio, the simple solution is to wrap the a.e.t. in {{nobold}}. Frietjes (talk) 20:42, 20 December 2022 (UTC)Reply
@Frietjes: I suppose, though it would be useful if there were an option to do this automatically, as not all editors may be aware/take the time to format the text in this way. S.A. Julio (talk) 20:59, 20 December 2022 (UTC)Reply
S.A. Julio, if we are only talking about one template, then making it automatic is not too hard, but predicting very possible way to write a.e.t., ot, etc. is more difficult. if you have a generic pattern match expression, feel free to post it here. Frietjes (talk) 21:01, 20 December 2022 (UTC)Reply
What about enabling this option for any text in brackets with something like |boldwinner=high_nobrackets? I could come up with a pattern match, but this might be an easier way. S.A. Julio (talk) 21:41, 20 December 2022 (UTC)Reply
I can't think of a situation when you would want to bold the a.e.t., so better to just check for that case. I will work on it, but it won't work for every possible "extra time". Frietjes (talk) 23:37, 20 December 2022 (UTC)Reply
should work now. Frietjes (talk) 23:45, 20 December 2022 (UTC)Reply
Wonderful, thank you! Would you know if this would be possible to implement with Module:RoundN as well? S.A. Julio (talk) 03:02, 21 December 2022 (UTC)Reply

Different widths for legs vs. aggregate

edit

@Frietjes: One additional question, is there a way for different widths to be defined for the legs vs. the aggregate scorelines? For example, brackets such as 2018–19 UEFA Europa League knockout phase#Bracket previously (before converting to this module) had a greater width for the aggregate score box, thus making it more prominent than the two legs. However, looking at the module documentation there does not seem to be a way to do this currently? It would also be useful if the score widths could be defined for specific rounds, e.g. for the width of the single-leg final score box to match the width of the aggregate scores. S.A. Julio (talk) 04:40, 22 December 2022 (UTC)Reply

S.A. Julio, sure we could do this, but it might be easier if we just add some left/right padding to provide more room for the aggregate? Frietjes (talk) 18:28, 22 December 2022 (UTC)Reply
@Frietjes: I guess that would work, though the score widths might be inconsistent between rounds if there is a double-digit score? Also, the score width would still need to be defined for the single-leg final, to match the width of the aggregate score boxes? S.A. Julio (talk) 20:12, 22 December 2022 (UTC)Reply
if you allow for the "score widths could be defined for specific rounds" then they will be inconsistent. the exact width of the boxes is going to be browser dependent, especially when mixing px and em units with different browser font implementations and screen widths. right now this bracket looks pretty good to me with the extra 3px padding on the aggregate scores. like I said, it is possible, but I was hoping for a more automatic solution that didn't require editors to adjust every bracket. also, at some point we are probably going to add template styles, which is not really compatible with free specification of the css. Frietjes (talk) 20:24, 22 December 2022 (UTC)Reply
@Frietjes: Alright, makes sense. Maybe it's just my browser but I can't notice much of a change for that bracket, though using 8px padding is noticeable for me. I've included an example bracket below that follows a similar width to what that bracket used in the past, was just wondering if there could be a way for the final score to be wider, similar to the width of the aggregate score boxes? Maybe when aggregate scores are used, and the final is only one leg, there could be a way for the module to automatically apply the padding for the final as well? S.A. Julio (talk) 20:45, 22 December 2022 (UTC)Reply
S.A. Julio, I have added an optional |agg-width= and removed the extra aggregate padding. having the module detect that there are aggregate rounds with a single round final and changing the width of the final seems complicated, unless that width is the same as the agg-width. Frietjes (talk) 21:24, 22 December 2022 (UTC)Reply
@Frietjes: Thanks, looks good. And that probably is too complicated, though maybe there could be some parameter to set the width for just the final round? Which could then be added to a template such as Template:32TeamBracket (for whenever aggregate scores are used and the final is one legged). Then it would not require every bracket to be changed. S.A. Julio (talk) 22:59, 22 December 2022 (UTC)Reply

Example

edit
Quarter-finals Semi-finals Final
          
  Benfica 4 0 4
  Eintracht Frankfurt (a) 2 2 4
  Eintracht Frankfurt 1 1 2
  Chelsea (p) 1 2 3
  Slavia Prague 0 3 3
  Chelsea 1 4 5
  Chelsea 4
  Arsenal 1
  Arsenal 2 1 3
  Napoli 0 0 0
  Arsenal 3 4 7
  Valencia 1 2 3
  Villarreal 1 0 1
  Valencia 3 2 5

Suggestion for style of seedings

edit

Currently the seedings and scores are displayed to the left and right of the players' names, in the same font size and style. This could be confusing. For example, the score of the first round is right next to the seedings of the second round. I think it'd be clearer if the seedings are moved to parentheses following the players' names, or in a different style than the scores to visually distinguish them. I don't know how to make a new template, but I made a few dummy brackets with snooker players in my sandbox, using the 2NTeam-NTeamBracket template and manually adding a tool tip to illustrate this. There's also a discussion on WikiProject Snooker about this. Thoughts? AmethystZhou (talk) 19:57, 2 November 2023 (UTC)Reply

Template-protected edit request on 19 July 2024

edit

Please add parameters to display dates and locations for games/matches, similar to what is currently on many brackets on FIFA World Cup and NFL playoff articles, as examples. Jalen Folf (Bark[s]) 19:42, 19 July 2024 (UTC)Reply

  Not done: it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format and provide a reliable source if appropriate. There is no actionable code change proposal for an uninvolved template editor to make yet. – Jonesey95 (talk) 21:48, 19 July 2024 (UTC)Reply

Unequal row heights when the third place is rendered

edit

When using the third place parameter, the entire row at the level of the third place header is malformed. Its height is 150 % compared to other rows. See the following example:

Quarterfinals Semifinals Finals
         
1  
8  
 
 
4  
5  
 
 
2  
7  
  Third place header
 
3    
6    

It doesn't look good, I don't like it at all. So I'm looking for an experienced editor who can fix it. Thanks, Maiō T. (talk) 10:23, 27 July 2024 (UTC)Reply

Edit request 14 August 2024

edit

Description of suggested change: I would like to update this template's module with the current revision of the sandbox (diff). I have added a functioning dark mode for the Vector 2022 skin and modified the colours on light mode to match other tables on Wikipedia.

This revision passes all five pages of the template's testcases (1, 2, 3, 4, 5). PitConclave (talk) 07:38, 14 August 2024 (UTC)Reply

  Done Nice work. – Jonesey95 (talk) 18:16, 14 August 2024 (UTC)Reply