Difference between revisions of "Template:SetTextPropertyCompletionRate"
Jump to navigation
Jump to search
(Created page with "<noinclude> This template is called from within other ''category'' templates (e.g. Author, Topic, Theory) to store the completion rate of a given textual property. The templat...") |
|||
Line 11: | Line 11: | ||
</noinclude><includeonly><!-- | </noinclude><includeonly><!-- | ||
-->{{#ifexpr: {{#len: {{{propertyvalue|}}} }} > {{{requiredwordcount|1}}}<!-- | -->{{#ifexpr: {{#len: {{{propertyvalue|}}} }} > {{{requiredwordcount|1}}}<!-- | ||
− | -->|<!-- if: store the value as complete | + | -->|Complete: CR_{{{propertyname}}}=100 <!-- if: store the value as complete |
-->{{#set: CR_{{{propertyname}}}=100}}<!-- | -->{{#set: CR_{{{propertyname}}}=100}}<!-- | ||
--><!-- | --><!-- | ||
− | -->|<!-- else: store the percentage | + | -->|Incomplete: CR_{{{propertyname}}}={{#expr: (100/{{{requiredwordcount|1}}} * {{#len: {{{propertyvalue|}}} }}) round 0}} <!-- else: store the percentage |
-->{{#set: CR_{{{propertyname}}}={{#expr: (100/{{{requiredwordcount|1}}} * {{#len: {{{propertyvalue|}}} }}) round 0}} }}<!-- | -->{{#set: CR_{{{propertyname}}}={{#expr: (100/{{{requiredwordcount|1}}} * {{#len: {{{propertyvalue|}}} }}) round 0}} }}<!-- | ||
--><!-- | --><!-- | ||
-->}}<!-- if length is greater than required word count | -->}}<!-- if length is greater than required word count | ||
--></includeonly> | --></includeonly> |
Revision as of 16:50, 8 June 2017
This template is called from within other category templates (e.g. Author, Topic, Theory) to store the completion rate of a given textual property. The template checks whether the text has the required length and given in |requiredwordcount=
. If the minimal word count is reached, then a completion rate of 100% is assigned to a property CR_{{{name}}}
. Otherwise, the rate of completion is stored in that property.
NOTE: As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values.
Parameters:
|propertyname=
- the name of the property for which a completion rate is to be calculated.|propertyvalue=
- the string value of the property; this is to be passed as a parameter, since not all properties are stored and, thus, not all properties are fetchable.|requiredwordcount=
- the minimal number of words to qualify as 100% complete.