Amending user data automatically

Hi Everyone,

I need some help regarding my app. I have created a tennis league, where players challenge each other and when the creator of the challenge wins immediately takes the ranking of the recipient of the challenge.

In my database i have data type “Challenge request” which includes, the players (which are users) the date of the match, the venue etc. I also have (and this is where i need help) a “Response time” field which is the day of creation of the challenge plus 2 days and a field called “Pending approval” which once the challenge is created is stated as “Yes” and when the challenge is accepted or declined is stated as “No”.

What i need my app to do, is to check the challenge requests that are still pending approval and also the response time has passed. Then to assign to the creator of the challenge the ranking of the recipient of the challenge and vice versa.

i have tried almost everything and unfortunately i didnt find a way to do it.

I will really appreciate your assistance guys!!!