Randomizing and Locking Content

It looks like there are two issues, lockedItems is not being reset when the generateButton is clicked, so the availableItems array will always be empty. You can fix this by adding lockedItems = [] at the beginning of the generateButton_click function. The lockButton click event handler is not updating the item in the Questions collection.

You can fix this by adding the following code to the click event handler:

await wixData.update("Questions", item);

This will update the item in the Questions collection with the latest version of the item object.