Template:tally time

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(keep track of both the total seconds and the number of entries ; update documentation accordingly ; this will temporarily break the current Toons By Length entry but will be fixed shortly)
(fix sorting by tally time: sort by the input time, lexicographically)
 
(includes 7 intermediate revisions)
Line 1: Line 1:
-
<includeonly>{{hcount|{{{1}}}_tally|{{{2}}}}} {{format seconds|{{{2}}}}} {{hcount|{{{1}}}_count}}</includeonly><noinclude>
+
<includeonly><span style="display:none">{{#expr: {{{2}}}+150000}} _<!-- This underscore is deliberate.  --></span>{{hcount|{{{1}}}_tally|{{{2}}}}} {{format seconds|{{{2}}}}} {{hcount|{{{1}}}_count|{{{offset_count|1}}}}}</includeonly><noinclude>
This template is used for tallying total time in a group of toons.
This template is used for tallying total time in a group of toons.
'''Usage:'''
'''Usage:'''
-
:<code><nowiki>{{ </nowiki> tally time | ''countername'' | ''number_of_seconds'' }}</code>
+
:<code><nowiki>{{ </nowiki> tally time | ''countername'' | ''number_of_seconds'' [| offset_count = ''count'']}}</code>
* where ''countername'' is the name of the counter being used. '''''This parameter is required.'''''   
* where ''countername'' is the name of the counter being used. '''''This parameter is required.'''''   
* and ''number_of_seconds'' is the number of total length of the toon in seconds.   
* and ''number_of_seconds'' is the number of total length of the toon in seconds.   
 +
* The (Optional) parameter <code>offset_count =</code> offsets the total count of toons by the ''count'' value passed to this parameter. This value defaults to one(1) when the parameter is not defined, since this is the original behavior of this template.
-
The template will do two things with this information:
+
The template will do three things with this information:
-
* The counter ''countername'' will be incremented by ''number_of_seconds'' seconds. This counter will then be used to keep track of the total number of seconds for all toons in the group.
+
* The counter ''countername''_tally will be incremented by ''number_of_seconds'' seconds. This counter will then be used to keep track of the total number of seconds for all toons in the group.
 +
* The counter ''countername''_count will be incremented by one(1). If the <code>offset_count =</code> parameter is set, it will instead be incremented by that value. This counter will then be used to keep track of the total number of individual toons in the group. This is used to calculate average running times.
* The value ''number_of_seconds'' will be converted to "hh:mm:ss" format using the {{t|format seconds}} template.
* The value ''number_of_seconds'' will be converted to "hh:mm:ss" format using the {{t|format seconds}} template.
'''IMPORTANT:'''  
'''IMPORTANT:'''  
-
Please be sure to first reset the counter using the {{t|hresetcount}} template before making any calls to this template in order for this process to work correctly.   This template initializes two counters: one to keep track of time in seconds and one to keep track of the total number of toon entries (used in calculating average running time). Both counters are initialized to 0. Here is the syntax:
+
Please be sure to first reset the counter using the {{t|hresetcount}} template before making any calls to this template in order for this process to work correctly. This template initializes two counters: one to keep track of time in seconds, and one to keep track of the total number of toon entries (used in calculating average running time). Both counters are initialized to 0. Here is the syntax:
:<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername'' | tally=1 }}</code>
:<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername'' | tally=1 }}</code>
-
* Note that the <code>tally=1</code> parameter is mandatory! This tells the template that we need to initialize tally counters. For the ''countername'' the template will create a counter called ''countername''_tally to track the total number of seconds and a counter called ''countername''_count to track the total number of toon entries.
+
* Note that the <code>tally=1</code> parameter is mandatory! This tells the template that we need to initialize tally counters. For the ''countername'', the template will create a counter called ''countername''_tally to track the total number of seconds and a counter called ''countername''_count to track the total number of toon entries.
-
* Multiple counters may be initialized using the {{t|hresetcount}} template. See {{t|hcount}} for more information.
+
* Multiple counters may be initialized using the {{t|hresetcount}} template. See {{t|hcount}} for more information.
'''Example:'''
'''Example:'''
-
<pre>
+
<pre style="white-space: pre-wrap; word-break: normal; overflow: scroll;">
{{hresetcount|sample|tally=1}}
{{hresetcount|sample|tally=1}}
Line 30: Line 32:
* {{tally time|sample|192}}
* {{tally time|sample|192}}
-
* Total time: {{#count:sample_tally|0}} seconds / {{format seconds|{{#count:sample_tally|0}}}} for {{#count:sample_count|0}} entries
+
* Total time: {{display time|sample|seconds}} seconds ({{display time|sample|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample|average_seconds}} seconds ({{display time|sample|average}} in hh:mm:ss) for {{display time|sample|count}} entries
 +
* Compare to the original mechanism {{--}} Total time: {{#count:sample_tally|0}} seconds / {{format seconds|{{#count:sample_tally|0}}}} for {{#count:sample_count|0}} entries
</pre>
</pre>
 +
'''Yields:'''
{{hresetcount|sample|tally=1}}
{{hresetcount|sample|tally=1}}
Line 40: Line 44:
* {{tally time|sample|192}}
* {{tally time|sample|192}}
-
* Total time: {{#count:sample_tally|0}} seconds / {{format seconds|{{#count:sample_tally|0}}}} for {{#count:sample_count|0}} entries
+
* Total time: {{display time|sample|seconds}} seconds ({{display time|sample|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample|average_seconds}} seconds ({{display time|sample|average}} in hh:mm:ss) for {{display time|sample|count}} entries
 +
* Compare to the original mechanism {{--}} Total time: {{#count:sample_tally|0}} seconds / {{format seconds|{{#count:sample_tally|0}}}} for {{#count:sample_count|0}} entries
 +
 
 +
 
 +
'''Offset Examples:'''
 +
 
 +
<pre style="white-space: pre-wrap; word-break: normal; overflow: scroll;">
 +
* {{display time|sample|seconds|offset_seconds=3}} {{--}} {{display time|sample|total|offset_seconds=3}}
 +
* {{display time|sample|seconds|offset_seconds=43}} {{--}} {{display time|sample|total|offset_seconds=43}}
 +
* {{display time|sample|seconds|offset_seconds=143}} {{--}} {{display time|sample|total|offset_seconds=143}}
 +
 
 +
* Add 1 to count: {{display time|sample|count|offset_count=1}}
 +
* Remove 1 from count: {{display time|sample|count|offset_count=-1}}
 +
 
 +
* {{display time|sample|average_seconds|offset_seconds=3|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=3|offset_count=1}}
 +
* {{display time|sample|average_seconds|offset_seconds=43|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=43|offset_count=1}}
 +
* {{display time|sample|average_seconds|offset_seconds=143|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=143|offset_count=1}}
 +
* {{display time|sample|average_seconds|offset_seconds=-60|offset_count=-1}} {{--}} {{display time|sample|average|offset_seconds=-60|offset_count=-1}}
 +
 
 +
</pre>
 +
 
 +
'''Yields:'''
 +
 
 +
* {{display time|sample|seconds|offset_seconds=3}} {{--}} {{display time|sample|total|offset_seconds=3}}
 +
* {{display time|sample|seconds|offset_seconds=43}} {{--}} {{display time|sample|total|offset_seconds=43}}
 +
* {{display time|sample|seconds|offset_seconds=143}} {{--}} {{display time|sample|total|offset_seconds=143}}
 +
 
 +
* Add 1 to count: {{display time|sample|count|offset_count=1}}
 +
* Remove 1 from count: {{display time|sample|count|offset_count=-1}}
 +
 
 +
* {{display time|sample|average_seconds|offset_seconds=3|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=3|offset_count=1}}
 +
* {{display time|sample|average_seconds|offset_seconds=43|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=43|offset_count=1}}
 +
* {{display time|sample|average_seconds|offset_seconds=143|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=143|offset_count=1}}
 +
* {{display time|sample|average_seconds|offset_seconds=-60|offset_count=-1}} {{--}} {{display time|sample|average|offset_seconds=-60|offset_count=-1}}
 +
 
 +
 
 +
'''Tally Time Count Offset:'''
 +
 
 +
<pre style="white-space: pre-wrap; word-break: normal; overflow: scroll;">
 +
{{hresetcount|sample2|tally=1}}
 +
 
 +
* {{tally time|sample2|160}}
 +
* {{tally time|sample2|133}}
 +
* {{tally time|sample2|172}}
 +
* {{tally time|sample2|292}}
 +
 
 +
* Total time: {{display time|sample2|seconds}} seconds ({{display time|sample2|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample2|average_seconds}} seconds ({{display time|sample2|average}} in hh:mm:ss) for {{display time|sample2|count}} entries
 +
 
 +
{{hresetcount|sample_grand_total|tally=1}}
 +
 
 +
* {{tally time|sample_grand_total|{{display time|sample|seconds}}|offset_count={{display time|sample|count}}}}
 +
* {{tally time|sample_grand_total|{{display time|sample2|seconds}}|offset_count={{display time|sample2|count}}}}
 +
 
 +
* Grand Total time: {{display time|sample_grand_total|seconds}} seconds ({{display time|sample_grand_total|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample_grand_total|average_seconds}} seconds ({{display time|sample_grand_total|average}} in hh:mm:ss) for {{display time|sample_grand_total|count}} entries
 +
 
 +
</pre>
 +
 
 +
'''Yields:'''
 +
 
 +
{{hresetcount|sample2|tally=1}}
 +
 
 +
* {{tally time|sample2|160}}
 +
* {{tally time|sample2|133}}
 +
* {{tally time|sample2|172}}
 +
* {{tally time|sample2|292}}
 +
 
 +
* Total time: {{display time|sample2|seconds}} seconds ({{display time|sample2|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample2|average_seconds}} seconds ({{display time|sample2|average}} in hh:mm:ss) for {{display time|sample2|count}} entries
 +
 
 +
{{hresetcount|sample_grand_total|tally=1}}
 +
 
 +
* {{tally time|sample_grand_total|{{display time|sample|seconds}}|offset_count={{display time|sample|count}}}}
 +
* {{tally time|sample_grand_total|{{display time|sample2|seconds}}|offset_count={{display time|sample2|count}}}}
 +
 
 +
* Grand Total time: {{display time|sample_grand_total|seconds}} seconds ({{display time|sample_grand_total|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample_grand_total|average_seconds}} seconds ({{display time|sample_grand_total|average}} in hh:mm:ss) for {{display time|sample_grand_total|count}} entries
====See Also====
====See Also====
-
* [[HRWiki:Counter|Counter function usage]]
+
* {{t|display time}} {{--}} Used to display various total values from tallies gathered by this template.
-
* {{t|hcount}}
+
* {{t|format seconds}}
* {{t|format seconds}}
 +
* {{t|hmss}}
 +
* {{t|hcount}}
 +
* [[HRWiki:Counter|Counter function usage]]
[[Category:Counter Formatting Templates|{{PAGENAME}}]]
[[Category:Counter Formatting Templates|{{PAGENAME}}]]
</noinclude>
</noinclude>

Current revision as of 13:21, 21 April 2025

This template is used for tallying total time in a group of toons.

Usage:

{{ tally time | countername | number_of_seconds [| offset_count = count]}}
  • where countername is the name of the counter being used. This parameter is required.
  • and number_of_seconds is the number of total length of the toon in seconds.
  • The (Optional) parameter offset_count = offsets the total count of toons by the count value passed to this parameter. This value defaults to one(1) when the parameter is not defined, since this is the original behavior of this template.

The template will do three things with this information:

  • The counter countername_tally will be incremented by number_of_seconds seconds. This counter will then be used to keep track of the total number of seconds for all toons in the group.
  • The counter countername_count will be incremented by one(1). If the offset_count = parameter is set, it will instead be incremented by that value. This counter will then be used to keep track of the total number of individual toons in the group. This is used to calculate average running times.
  • The value number_of_seconds will be converted to "hh:mm:ss" format using the {{format seconds}} template.

IMPORTANT:

Please be sure to first reset the counter using the {{hresetcount}} template before making any calls to this template in order for this process to work correctly. This template initializes two counters: one to keep track of time in seconds, and one to keep track of the total number of toon entries (used in calculating average running time). Both counters are initialized to 0. Here is the syntax:

{{hresetcount | countername | tally=1 }}
  • Note that the tally=1 parameter is mandatory! This tells the template that we need to initialize tally counters. For the countername, the template will create a counter called countername_tally to track the total number of seconds and a counter called countername_count to track the total number of toon entries.
  • Multiple counters may be initialized using the {{hresetcount}} template. See {{hcount}} for more information.


Example:

{{hresetcount|sample|tally=1}}

* {{tally time|sample|60}}
* {{tally time|sample|33}}
* {{tally time|sample|72}}
* {{tally time|sample|192}}

* Total time: {{display time|sample|seconds}} seconds ({{display time|sample|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample|average_seconds}} seconds ({{display time|sample|average}} in hh:mm:ss) for {{display time|sample|count}} entries
* Compare to the original mechanism {{--}} Total time: {{#count:sample_tally|0}} seconds / {{format seconds|{{#count:sample_tally|0}}}} for {{#count:sample_count|0}} entries

Yields:


  • 150060 _60 1:00 1
  • 150033 _93 0:33 2
  • 150072 _165 1:12 3
  • 150192 _357 3:12 4
  • Total time: 357 seconds (5:57 in hh:mm:ss)  · Average: 89 seconds (1:29 in hh:mm:ss) for 4 entries
  • Compare to the original mechanism — Total time: 357 seconds / 5:57 for 4 entries


Offset Examples:

* {{display time|sample|seconds|offset_seconds=3}} {{--}} {{display time|sample|total|offset_seconds=3}}
* {{display time|sample|seconds|offset_seconds=43}} {{--}} {{display time|sample|total|offset_seconds=43}}
* {{display time|sample|seconds|offset_seconds=143}} {{--}} {{display time|sample|total|offset_seconds=143}}

* Add 1 to count: {{display time|sample|count|offset_count=1}}
* Remove 1 from count: {{display time|sample|count|offset_count=-1}}

* {{display time|sample|average_seconds|offset_seconds=3|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=3|offset_count=1}}
* {{display time|sample|average_seconds|offset_seconds=43|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=43|offset_count=1}}
* {{display time|sample|average_seconds|offset_seconds=143|offset_count=1}} {{--}} {{display time|sample|average|offset_seconds=143|offset_count=1}}
* {{display time|sample|average_seconds|offset_seconds=-60|offset_count=-1}} {{--}} {{display time|sample|average|offset_seconds=-60|offset_count=-1}}

Yields:

  • 360 — 6:00
  • 400 — 6:40
  • 500 — 8:20
  • Add 1 to count: 5
  • Remove 1 from count: 3
  • 72 — 1:12
  • 80 — 1:20
  • 100 — 1:40
  • 99 — 1:39


Tally Time Count Offset:

{{hresetcount|sample2|tally=1}}

* {{tally time|sample2|160}}
* {{tally time|sample2|133}}
* {{tally time|sample2|172}}
* {{tally time|sample2|292}}

* Total time: {{display time|sample2|seconds}} seconds ({{display time|sample2|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample2|average_seconds}} seconds ({{display time|sample2|average}} in hh:mm:ss) for {{display time|sample2|count}} entries

{{hresetcount|sample_grand_total|tally=1}}

* {{tally time|sample_grand_total|{{display time|sample|seconds}}|offset_count={{display time|sample|count}}}}
* {{tally time|sample_grand_total|{{display time|sample2|seconds}}|offset_count={{display time|sample2|count}}}}

* Grand Total time: {{display time|sample_grand_total|seconds}} seconds ({{display time|sample_grand_total|total}} in hh:mm:ss) {{dot}} Average: {{display time|sample_grand_total|average_seconds}} seconds ({{display time|sample_grand_total|average}} in hh:mm:ss) for {{display time|sample_grand_total|count}} entries

Yields:


  • 150160 _160 2:40 1
  • 150133 _293 2:13 2
  • 150172 _465 2:52 3
  • 150292 _757 4:52 4
  • Total time: 757 seconds (12:37 in hh:mm:ss)  · Average: 189 seconds (3:09 in hh:mm:ss) for 4 entries


  • 150357 _357 5:57 4
  • 150757 _1114 12:37 8
  • Grand Total time: 1114 seconds (18:34 in hh:mm:ss)  · Average: 139 seconds (2:19 in hh:mm:ss) for 8 entries

[edit] See Also

Personal tools