Puzzles are only collected when a student successfully completes a level. When a student runs out of JiJis, they are taken back to the beginning of the level without collecting puzzles.
Students always earn puzzles for playing new levels, but they won't earn puzzles if they play a level with a green checkmark on it. This means a student playing games in their History or earlier on the island won't collect any puzzles. If a student is replaying games, you may want to remind the student to click avoid the history button and be sure to click on new levels to move forward in ST Math.