Student Gamification: XP, Levels & Streaks. avatar

Student Gamification: XP, Levels & Streaks.

Pricing

from $4.40 / 1,000 results

Go to Apify Store
Student Gamification: XP, Levels & Streaks.

Student Gamification: XP, Levels & Streaks.

Student gamification features (XP, Levels & Streaks), a repetitive task that could be automated with a tool.

Pricing

from $4.40 / 1,000 results

Rating

0.0

(0)

Developer

Lore Nest

Lore Nest

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

10 days ago

Last modified

Categories

Share

Student gamification features (XP, Levels & Streaks), a repetitive task that could be automated with a tool.

This Actor is a lightweight backend service that updates student XP, recalculates their level, and maintains daily activity streaks based on activity events you feed it. It is designed to be called repeatedly with student state and an activity date, so any learning platform can layer on motivation mechanics without rebuilding the underlying math or date logic. By centralizing this logic in a single deterministic function, you avoid bugs around streak resets, level drift, and timezone-related off-by-one errors that typically creep into homegrown implementations.

Use Cases

  • Daily streak tracking for a course platform — submit each student's last_activity_date and current_streak along with the day's activity_date, and the engine returns the updated streak (incremented when the new day is exactly one day after the last, preserved when the same day, reset to 1 when the gap is larger).
  • Level recalculation after XP rewards — feed in a student's accumulated current_xp and receive their new level, computed as floor(total_xp / 1000) + 1 from the calculate_level static method, with a minimum level of 1 when XP is zero or negative.
  • Bulk nightly batch processing of an entire cohort — pass an array of student records plus a single activity_date in one payload to update every student in a single invocation, returning a results list keyed by student_id.
  • Streak recovery validation — input handling includes try/except around date parsing, so malformed last_activity_date strings fall back to a streak of 1 instead of crashing the batch.
  • Idempotent same-day activity logging — because the streak logic treats a delta == 0 day delta as "no change," resubmitting an event for the same calendar date will not inflate the streak count.

How It Works

The Actor wraps a GamificationEngine class with two static methods and a run(payload) entry point. The run function extracts a list of student records and an activity_date from the payload, then for each student computes the new streak via update_streak (which parses both dates as ISO YYYY-MM-DD, computes the day delta, and applies the increment/preserve/reset rule) and the new level via calculate_level using the 1000-XP-per-level constant. The function returns a list of updated student profiles, or an {"error": "Missing activity_date"} object when the required date field is absent from the input.

Usage on Apify

Run it directly from the Apify Console ("Start"/"Try for free"), or call it via the API:

POST https://api.apify.com/v2/acts/student-gamification-xp-levels-streak/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>
Content-Type: application/json
{}

Pricing

Pay-per-event, billed automatically by Apify -- no separate account or payment step:

  • Actor start: $0.00005 per GB of memory (minimum one event per run)
  • Result: $0.005 per item returned -- this is the primary, usage-based charge

Also independently available at $0.0100 USDC (Base) per call via the x402 payment protocol (POST /tools/student-gamification-xp-levels-streak) for callers outside the Apify platform.

Example output

Real output captured from this tool's own build-time smoke test (input above):

{
"error": "Missing activity_date"
}