Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Competition And Contest rules are where you define the conditions that award points, as well as Start, Stop, Finish, and Finalize the Contest. 

An example of the rule system in CompetitionLabs is shown below.


RULES

EXAMPLES


Start the contests

Required

Model

By default the start contest is pre selected as The contests parents are all finalised. That means that all the contests before the one that has to start are all finalised.

Note

If no contests are before the one you are creating like for example you are only creating one contest - then that means that the contest will start when the competition container will start


Finish the contests

Required

Model

The contest will finish when the contests have been active for more than or exactly the time between contests start and competitions end time.

Note

The constant can be in put manually or you can select a pre created constant.


Finalise the contests

Required

Model

The contest will finalise when the contests finished is equal or more than 1 minute, that means that the contest will finalise after the contest has finished and the finalisation time will be for 1 minute.

Note

The Constant can only be numeric and it represents the finalisation time.


Custom points

Required

Model

Custom points is a Rule set that lets you create more complex competitions. You can add points, subtract them, multiply or use your own adjustment factor. 

Tip

To add an extra rule set that will calculate differently with different actions just click on Add Rule Set and add the same Custom points rule set and the rule sets will work together.


Note

You can read more about Rules here



APP Example:

Start the contests


Expand


Finish the contests


Expand


Finalise the contests


Expand


Custom points


Expand



API Example:

Code Block
languagejs
titleRules example
collapsetrue
"jsonClass": "Contest",

     ...

     "ruleSets": [
     {
          "jsonClass": "RuleSet",
          "priority": 1,
          "scope": "contest",
          "action": "open.contest",
          "conditions": [
          {
               "jsonClass": "MainConditionSet",
               "matchCondition": "All",
               "mustEvaluateTo": true,
               "rules": [
               {
                    "jsonClass": "MainRule",
                    "fact": "contest.parents.status",
                    "operator": "==",
                    "constant": "$finalised.status"
                    }]
               }]
     },
{
     "jsonClass": "RuleSet",
     "priority": 2,
     "scope": "contest",
     "action": "finish.contest",
     "conditions": [
     {
          "jsonClass": "MainConditionSet",
          "matchCondition": "All",
          "mustEvaluateTo": true,
          "rules": [
          {
               "jsonClass": "MainRule",
               "fact": "contest.active.elapsed",
               "operator": ">=",
               "constant": "$competitions.scheduled.end"
               }]
          }]
     },
     {
     "jsonClass": "RuleSet",
     "priority": 3,
     "scope": "contest",
     "action": "finalise.contest",
     "conditions": [
     {
          "jsonClass": "MainConditionSet",
          "matchCondition": "All",
          "mustEvaluateTo": true,
          "rules": [
          {
               "jsonClass": "MainRule",
               "fact": "contest.finish.elapsed",
               "operator": ">=",
               "constant": "1"
               }]
          }]
     },{
     "jsonClass": "RuleSet",
     "priority": 4,
     "scope": "contest",
     "action": "contests.points.calculated.custom",
     "conditions": [
     {
          "jsonClass": "MainConditionSet",
          "matchCondition": "All",
          "mustEvaluateTo": true,
          "rules": [
          {
               "jsonClass": "MainRule",
               "fact": "event.count",
               "operator": ">=",
               "constant": "1",
               "subConditions": [
               {
                    "jsonClass": "SubConditionSet",
                    "matchCondition": "All",
                    "mustEvaluateTo": true,
                    "subRules": [
                     {
                         "jsonClass": "SubRule",
                         "fact": "event.action.type",
                         "operator": "==",
                         "constant": "bet"
                         }]
                    }]
               }]
          }],
     "onMatchThen": "add",
     "onMatchConstant": "1"
     },
     {
     "jsonClass": "RuleSet",
     "priority": 5,
     "scope": "contest",
     "action": "contests.points.calculated.custom",
     "conditions": [
     {
          "jsonClass": "MainConditionSet",
          "matchCondition": "All",
          "mustEvaluateTo": true,
          "rules": [
          {
               "jsonClass": "MainRule",
               "fact": "event.count",
               "operator": ">=",
               "constant": "1",
               "subConditions": [
               {
                    "jsonClass": "SubConditionSet",
                    "matchCondition": "All",
                    "mustEvaluateTo": true,
                    "subRules": [
                    {
                         "jsonClass": "SubRule",
                         "fact": "event.action.type",
                         "operator": "==",
                         "constant": "win"
                         }]
                    }]
               }]
          }
     ],
     "onMatchThen": "add",
     "onMatchConstant": "3"
     }
    ],

...

A full example of POST Competition can be found in the Competitions APP API documentation here


Warning

The rule sets that are shown as an example are considered a working scenario. Any edits made can influence the contests starting, finishing, finalising or points calculation. Please be aware and do testing before going live with the contest.

More in-depth rules guide, templates and

combination

combinations

Tip

You can read more about Rules, preview some of the templates and their combinations here

Status
subtletrue
colourGreen
titlecontinue
 When all the Rule sets are complete, click Next to proceed to the next step.

Next: Step 5: Simple Competition rewards