XP

Course XP Settings Metadata Documentation

Overview

The XP settings metadata defines how experience points are awarded for different types of content within a course. The settings support base XP values for all content types, with additional multiplier configurations for interactive content like exercises and quizzes.

Data Structure

interface XPSettings {
  video: number;
  article: number;
  exercise: {
    value: number;
    multipliers: ScoreMultiplier[];
  };
  quiz: {
    value: number;
    multipliers: ScoreMultiplier[];
    attemptMultipliers: AttemptMultiplier[];
  };
}

interface ScoreMultiplier {
  start: number;      // Score range start (0-100)
  end: number;        // Score range end (0-100)
  xpMultiplier: number; // Multiplier value (decimal between 0 and 1)
}

interface AttemptMultiplier {
  attempt: number;      // Attempt number (1-based index)
  xpMultiplier: number; // Multiplier value (decimal between 0 and 1)
}

Content Types

Basic Content

  1. Video

    • Simple base XP value

    • Example: { "video": 100 }

  2. Article

    • Simple base XP value

    • Example: { "article": 50 }

Interactive Content

  1. Exercise

    • Base XP value with score-based multipliers

    • Multipliers define XP modifications based on score ranges

    • Example:

      {
        "exercise": {
          "value": 200,
          "multipliers": [
            {"start": 0, "end": 60, "xpMultiplier": 0.5},
            {"start": 61, "end": 80, "xpMultiplier": 0.8},
            {"start": 81, "end": 100, "xpMultiplier": 1.0}
          ]
        }
      }
  2. Quiz

    • Base XP value with both score-based and attempt-based multipliers

    • Supports multiple attempts with decreasing XP rewards

    • Example:

      {
        "quiz": {
          "value": 300,
          "multipliers": [
            {"start": 0, "end": 50, "xpMultiplier": 0.4},
            {"start": 51, "end": 75, "xpMultiplier": 0.7},
            {"start": 76, "end": 100, "xpMultiplier": 1.0}
          ],
          "attemptMultipliers": [
            {"attempt": 1, "xpMultiplier": 1.0},
            {"attempt": 2, "xpMultiplier": 0.8},
            {"attempt": 3, "xpMultiplier": 0.6}
          ]
        }
      }

XP Calculation Rules

  1. Basic Content (Video/Article)

    • XP awarded = base value

  2. Exercise

    • Final XP = base value × applicable score multiplier

    • Score multipliers are based on percentage ranges

    • Only one multiplier should be applicable for any given score

  3. Quiz

    • Final XP = base value × score multiplier × attempt multiplier

    • Both score and attempt multipliers are applied multiplicatively

    • Attempt multipliers typically decrease with each subsequent attempt

Complete Example with Explanation

{
  "video": 0,
  "article": 0,
  "exercise": {
    "value": 10,
    "multipliers": [
      {
        "start": 0,
        "end": 80,
        "xpMultiplier": 0.5
      },
      {
        "start": 81,
        "end": 101,
        "xpMultiplier": 1
      }
    ]
  },
  "quiz": {
    "value": 10,
    "multipliers": [
      {
        "start": 0,
        "end": 80,
        "xpMultiplier": 0.5
      },
      {
        "start": 81,
        "end": 101,
        "xpMultiplier": 1
      }
    ],
    "attemptMultipliers": [
      {
        "attempt": 1,
        "xpMultiplier": 1
      },
      {
        "attempt": 2,
        "xpMultiplier": 0.5
      }
    ]
  }
}

Example Explanation

This configuration demonstrates a course that focuses on interactive content (exercises and quizzes) for XP rewards:

  1. Basic Content

    • Videos and articles are set to 0 XP, meaning completion of these items doesn't award XP

  2. Exercise Settings

    • Base value: 10 XP

    • Score multipliers:

      • Scores 0-80%: Awards 5 XP (10 × 0.5)

      • Scores 81-101%: Awards 10 XP (10 × 1.0)

      • Note: The 101% upper bound allows for potential bonus points

  3. Quiz Settings

    • Base value: 10 XP

    • Score multipliers (same as exercise):

      • Scores 0-80%: Multiplier of 0.5

      • Scores 81-101%: Multiplier of 1.0

    • Attempt multipliers:

      • First attempt: 100% of calculated XP

      • Second attempt: 50% of calculated XP

Example Calculations:

  • If a student scores 75% on an exercise: 10 XP × 0.5 = 5 XP

  • If a student scores 90% on a quiz:

    • First attempt: 10 XP × 1.0 × 1.0 = 10 XP

    • Second attempt: 10 XP × 1.0 × 0.5 = 5 XP

API Usage

The XP settings can be updated via a PATCH request to:

PATCH https://api.alpha1edtech.com/courses/{courseId}
Content-Type: application/json

{
  "metadata": {
    // XP settings object
  }
}

Validation Rules

  1. Base values must be non-negative numbers

  2. Score ranges must be between 0 and 100

  3. Multiplier values are typically between 0 and 1 (represented as percentages in the UI)

  4. Score ranges should not overlap within a content type

  5. Attempt numbers should be sequential starting from 1

  6. Base values are overriden by item specific XP, but multipliers are retained

Last updated