Module 11 · In Studio · challenge 1 of 2 in this lesson

pickRevision returns the newest revision strictly before the incident that is not DELETED, from a list in any order

A test in Studio grades it and prints a pass code.

Open

Level 3, Professional

Challenge

Fix challenges/work/data_ops.luau so the restore and erasure rules in this lesson hold. The test is challenges/player-data-ops.luau and the written solution is challenges/solutions/player-data-ops.md. It touches no data store.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("player-data-ops", "player-data-ops-tools") in the server command bar. Copy the pass code from Output.

Done means

  • pickRevision returns the newest revision strictly before the incident that is not DELETED, from a list in any order
  • restoredData keeps the higher coins, Speed if either copy owns it, legacyImported if either is true, the furthest onboarding step and every purchase id once (at most 50, newest kept), without changing its inputs
  • canWrite refuses while MetaData.ActiveSession is a table and refuses a missing entry
  • rtbfTemplates covers Player_{UserId}, {UserId} and the ordered {UserId} leaderboard; receiptRowBelongs reads PlayerId; parseErasure checks the type, the id and the start places
  • challenges/player-data-ops.luau prints TEST PASS for every check

The Course Runner prints this code when the test passes.