This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

Difference between revisions of "Template:OWASP Points Calculator"

From OWASP
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#expr:  
+
<includeonly>{{#ifexpr:{{#expr: {{#time: Y }} - {{{year}}}}} <= 2|
 +
{{#expr:  
 
{{#switch: {{{activity}}}
 
{{#switch: {{{activity}}}
 
  | b1 = 200
 
  | b1 = 200
Line 7: Line 8:
 
  | c3 = 40
 
  | c3 = 40
 
  | c4 = 10
 
  | c4 = 10
 +
| #default = 0
 
}} div {{#ifexpr:{{#expr: {{#time: Y }} - {{{year}}}}} <= 1| 1 | 2}}
 
}} div {{#ifexpr:{{#expr: {{#time: Y }} - {{{year}}}}} <= 1| 1 | 2}}
}}</includeonly>
+
}} | 0
 
+
}}</includeonly><noinclude>
<noinclude>
 
 
== Usage ==
 
== Usage ==
'''<nowiki>{{OWASP Points|activity=<Activity Identifier>|year=<<Year of Activity>>|detail=<<Free-Form Text>>}}</nowiki>'''
+
'''<nowiki>{{OWASP Points Calculator|activity={{{activity}}}|year={{{year}}}}}</nowiki>'''
  
 +
==Help==
 +
This template is used for the actual calculating OWASP Points.  It requires 2 parameters:
 +
* activity = The activity identifier (the code here actually does the translation, see [[OWASP Points]] for human readable detail), if this is an invalid code, points default to 0.
 +
* year = The year that the points were earned
  
This template is used for calculating OWASP PointsIt requires 3 parameters:
+
===Formula===
* activity = The activity identifier (defined in the [http://www.owasp.org/index.php?title=Template:OWASP_Points_Calculator OWASP Points Calculator template])
+
First, the function checks to see if the points are <= 2 years old, if this is true, the function returns 0If the points are fresher than 2 years it uses the activity code to do a look-up of the full point value of the activity.  If the difference between the current year and the year the points were earned is 0 or 1 (earned same year or earned last year), the full point value is passed.  If the points were earned 2 years ago, half the point value is passed.
* year = The year that the points were '''earned'''
 
* detail = A free text field explaining the reason points earned (project name, conference name etc)
 
  
 +
==Code==
 +
<nowiki>
 +
{{#ifexpr:{{#expr: {{#time: Y }} - {{{year}}}}} <= 2|
 +
{{#expr:
 +
{{#switch: {{{activity}}}
 +
| b1 = 200
 +
| b2 = 100
 +
| c1 = 150
 +
| c2 = 100
 +
| c3 = 40
 +
| c4 = 10
 +
| #default = 0
 +
}} div {{#ifexpr:{{#expr: {{#time: Y }} - {{{year}}}}} <= 1| 1 | 2}}
 +
}} | 0
 +
}}
 +
</nowiki>
  
The template also calls the [http://www.owasp.org/index.php?title=Template:OWASP_Points_Calculator OWASP Points Calculator template]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 22:44, 7 January 2011

Usage

{{OWASP Points Calculator|activity={{{activity}}}|year={{{year}}}}}

Help

This template is used for the actual calculating OWASP Points. It requires 2 parameters:

  • activity = The activity identifier (the code here actually does the translation, see OWASP Points for human readable detail), if this is an invalid code, points default to 0.
  • year = The year that the points were earned

Formula

First, the function checks to see if the points are <= 2 years old, if this is true, the function returns 0. If the points are fresher than 2 years it uses the activity code to do a look-up of the full point value of the activity. If the difference between the current year and the year the points were earned is 0 or 1 (earned same year or earned last year), the full point value is passed. If the points were earned 2 years ago, half the point value is passed.

Code

{{#ifexpr:{{#expr: {{#time: Y }} - {{{year}}}}} <= 2| {{#expr: {{#switch: {{{activity}}} | b1 = 200 | b2 = 100 | c1 = 150 | c2 = 100 | c3 = 40 | c4 = 10 | #default = 0 }} div {{#ifexpr:{{#expr: {{#time: Y }} - {{{year}}}}} <= 1| 1 | 2}} }} | 0 }}