Best way to remove prior purchases?

I have a classroom gaming app where students make purchases. In the event they “die” and must be revived, I am trying to figure a way to have their prior purchases not factor into new purchases total once they are “revived”. I could have the teacher admins go into the Google sheet, sort for that user and delete all prior rows containing their transactions but was hoping for a more elegant solution in-app. I made a choice component toggle 0-1 and when 0 then the previous purchases will no longer count toward energy balance but then I am stuck with future purchases not being able to count. Any ideas?

I have achieved something similar by using sessions and linking the “purchases” to these. Then a session “dies” rather than a “purchase” if that makes sense. When a user dies, the current session “dies” do all of its purchases die with it. When the user “comes alive” again it’s via a new session and all subsequent purchases are attached to this rather than to the prior dead session.

Interesting solution: when the session ends, are they logging back in with the same username/email though? Trying to visualize your structure of sessions

Yeah. The user is represented by the same row. When they login, if they have no current “live session” then they need to create one. Subsequent purchases are associated with this. So I would envisage a sessions sheet with a relation back to your user. In the user sheet they need a relation to their “current session” which will always be “alive”. When you submit a purchase, link it to both a user and their current session. The users purchase are then those associated with the user AND their current session.

2 Likes

Thanks, I will give it try.