Difference between revisions of "Template:SetDatePropertyCompletionRate"

From Encyclopedia of Scientonomy
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 ''date'' property. The templa...")
 
 
Line 10: Line 10:
 
* <code><nowiki>|propertyvalueday=</nowiki></code> - the day value.  
 
* <code><nowiki>|propertyvalueday=</nowiki></code> - the day value.  
 
* <code><nowiki>|requireddateprecision=</nowiki></code> - the required date precision; allowed values are <code><nowiki>Year</nowiki></code>, <code><nowiki>Month</nowiki></code>, and <code><nowiki>Day</nowiki></code>; the default is <code><nowiki>Day</nowiki></code>.  
 
* <code><nowiki>|requireddateprecision=</nowiki></code> - the required date precision; allowed values are <code><nowiki>Year</nowiki></code>, <code><nowiki>Month</nowiki></code>, and <code><nowiki>Day</nowiki></code>; the default is <code><nowiki>Day</nowiki></code>.  
 +
* <code><nowiki>|returnvalue=</nowiki></code> - if nonempty, the calculated value is returned.
  
 
</noinclude><includeonly><!--
 
</noinclude><includeonly><!--
Line 59: Line 60:
 
--><!-- store the value  
 
--><!-- store the value  
 
-->{{#set: CR_{{{propertyname}}}={{#var: varCR}} }}<!--  
 
-->{{#set: CR_{{{propertyname}}}={{#var: varCR}} }}<!--  
 +
--><!-- return the value if necessary
 +
-->{{#if: {{{returnvalue|}}}|{{#var: varCR}}|}}<!-- 
 
--></includeonly>
 
--></includeonly>

Latest revision as of 02:28, 9 June 2017

This template is called from within other category templates (e.g. Author, Topic, Theory) to store the completion rate of a given date property. The template checks whether the Year, Month, and Day components of the date are present. Depending on the value of |requireddateprecision=, the template calculates the completion rate and stores the value in a property titled CR_{{{propertyname}}}.

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.
  • |propertyvalueyear= - the year value.
  • |propertyvaluemonth= - the month value.
  • |propertyvalueday= - the day value.
  • |requireddateprecision= - the required date precision; allowed values are Year, Month, and Day; the default is Day.
  • |returnvalue= - if nonempty, the calculated value is returned.