Difference between revisions of "Template:Winning percentage"
From Ava Zinn Wiki
[unchecked revision] | [unchecked revision] |
(treat unspecified/empty parameters as 0) |
Aeverinezinn (talk | contribs) m (19 revisions from wikipedia:Template:Winning percentage) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly>{{#ifexpr:{{#if:{{{1|}}}|{{{1}}}|0}}+{{#if:{{{2|}}}|{{{2}}}|0}}+{{#if:{{{3|}}}|{{{3}}}|0}}=0| | + | <includeonly>{{#ifeq:{{{record|}}}|y|{{#if:{{{1|}}}|{{{1}}}|0}}–{{#if:{{{2|}}}|{{{2}}}|0}}{{#if:{{{3|}}}|–{{{3}}}}} (}}{{#ifexpr:{{#if:{{{1|}}}|{{{1}}}|0}}+{{#if:{{{2|}}}|{{{2}}}|0}}+{{#if:{{{3|}}}|{{{3}}}|0}}=0|–|{{#ifeq:{{#expr:({{{1}}}{{#if:{{{3|}}}|+({{{3}}}/2)}})/({{{1}}}+{{{2}}}{{#if:{{{3|}}}|+{{{3}}}}}) round 3}}|0|{{#ifeq:{{{leading_zero|}}}|y|0}}.000|{{#ifeq:{{#expr:({{{1}}}{{#if:{{{3|}}}|+({{{3}}}/2)}})/({{{1}}}+{{{2}}}{{#if:{{{3|}}}|+{{{3}}}}}) round 3}}|1|1.000|{{#ifeq:{{{leading_zero|}}}|y|0}}{{str right|{{padright:{{#expr:({{{1}}}{{#if:{{{3|}}}|+({{{3}}}/2)}})/({{{1}}}+{{{2}}}{{#if:{{{3|}}}|+{{{3}}}}}) round 3}}|5|0}}|1}}}}}}}}{{#ifeq:{{{record|}}}|y|)}}</includeonly><noinclude> |
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Latest revision as of 23:24, 6 March 2016
Usage[edit]
This template calculates the winning percentage given three parameters: wins, losses and ties. Those three parameters are unnamed.
{{Winning percentage|<wins>|<losses>|<ties>}}
Wins and losses are required while ties are optional. In addition, including |leading_zero=y
will add a leading 0 before the period (.), while adding |record=y
will show the record followed by the winning percentage.
Code | Result |
---|---|
{{Winning percentage|100|50|3}}
|
Expression error: Unrecognized punctuation character "{". |
{{Winning percentage|100|50}}
|
Expression error: Unrecognized punctuation character "{". |
{{Winning percentage|100|50|record=y}}
|
100–50 (Expression error: Unrecognized punctuation character "{".) |
{{Winning percentage|100|50|3|leading_zero=y|record=y}}
|
100–50–3 (0Expression error: Unrecognized punctuation character "{".) |
{{Winning percentage|100|50|leading_zero=y}}
|
0Expression error: Unrecognized punctuation character "{". |
{{Winning percentage|100|0}}
|
1.000 |
{{Winning percentage|0|4}}
|
.000 |
{{Winning percentage|0|0}}
|
– |
Aliases[edit]
See also[edit]
- {{Win-loss record}}
- {{Percentage}}
The above documentation is transcluded from Template:Winning percentage/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |