{
  "name": "Count Volunteer badges and upgrade",
  "nodes": [
    {
      "id": "96e7894f-ddb1-4f95-87d4-911137cbc93d",
      "type": "condition:if",
      "typeVersion": "1.0",
      "name": "=10 Bronze?",
      "parameters": {
        "combinator": "and",
        "conditions": [
          {
            "id": "d79fcedb-d001-4ca2-9912-d71234e7f4f5",
            "operator": {
              "type": "number",
              "operation": "equals",
              "singleValue": false
            },
            "leftValue": "={{ $json.unlock_count }}",
            "rightValue": "10"
          }
        ]
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 637.1608432564618,
        "y": 221.5761448900636
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "e66d1357-8c01-4f4c-8ffe-8624ed9912fe",
      "type": "action:badge",
      "typeVersion": "1.0",
      "name": "Grant Volunteer Silver",
      "parameters": {
        "reason": "=",
        "badge_id": 155,
        "username": "={{ $(\"Data Explorer\").first().json.username }}",
        "operation": "grant",
        "actor_username": "system"
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 811.4280503471603,
        "y": 211.7131512868232
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "7238cd61-dffd-47bf-9ae3-bca39511ec39",
      "type": "condition:if",
      "typeVersion": "1.0",
      "name": "=25 Bronze?",
      "parameters": {
        "combinator": "and",
        "conditions": [
          {
            "id": "d79fcedb-d001-4ca2-9912-d71234e7f4f5",
            "operator": {
              "type": "number",
              "operation": "equals",
              "singleValue": false
            },
            "leftValue": "={{ $json.unlock_count }}",
            "rightValue": "25"
          }
        ]
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 633.1349549848298,
        "y": 373.4856927116641
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "d00f31ae-e57b-4c82-bcf3-77df88049834",
      "type": "action:badge",
      "typeVersion": "1.0",
      "name": "Grant Volunteer Gold",
      "parameters": {
        "reason": "=",
        "badge_id": 154,
        "username": "={{ $(\"Data Explorer\").first().json.username }}",
        "operation": "grant",
        "actor_username": "system"
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 807.1679902194247,
        "y": 359.669212693224
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "96a5b4fc-d3bf-4fd1-91ae-f26c95cbd05a",
      "type": "action:sql",
      "typeVersion": "1.0",
      "name": "Data Explorer",
      "parameters": {
        "query_id": 4,
        "operation": "queries",
        "query_params": {
          "user": "={{ $json.user.username }}"
        }
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 472.2675866186891,
        "y": 295.18255318231
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "d841c29a-3b01-4e3d-8e97-df15aa14e013",
      "type": "trigger:badge_granted",
      "typeVersion": "1.0",
      "name": "Badge granted",
      "parameters": {
        "badge_id": 156
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 305.7007893205157,
        "y": 293.7658243392797
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    }
  ],
  "connections": {
    "=10 Bronze?": {
      "main": [
        [
          {
            "node": "Grant Volunteer Silver",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "=25 Bronze?": {
      "main": [
        [
          {
            "node": "Grant Volunteer Gold",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Badge granted": {
      "main": [
        [
          {
            "node": "Data Explorer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data Explorer": {
      "main": [
        [
          {
            "node": "=10 Bronze?",
            "type": "main",
            "index": 0
          },
          {
            "node": "=25 Bronze?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "variables": [],
  "staticData": {}
}