Forum Academy Marketplace Showcase Pricing Features

A hypothetical situation

Hello , good morning everyone, please guide me in solving this imaginary situation. Suppose a contest starts as soon as the page is loaded, the rules of the contest are that the user has to make a prediction about in how much time he will do a certain job in minutes, we will wait 30 seconds for the users so to ensure we get more than 1 user’data and if we gets the data of 5 users within 30 secs then as soon as we gets it the contests we will be stopped else we will wait for 30 sec. Once this is done we will check whose duration is the least, one having the least duration will win the contest i.e. we will show a congratulatory message.

Hi there, @waseemahm11011… this hypothetical situation looked like a fun little challenge, so I put together an example that I believe does exactly what you have described.

First, I created data types for Contest and Prediction with the following fields…

contest-data-type

prediction-data-type

Then, I put a group on a page that, for my purposes, has a data source of the first (and only) contest in my database.

When the page is loaded, I have a workflow that makes changes to the contest every 1 second, and the changes it makes are as follows…

I also have a workflow associated with a submit button that enables the user to submit their prediction…

Finally, I have the following elements in the group on the page…

  • A text element that displays the Parent Group's Contest's countdown
  • An input element where the user types their prediction
  • A submit button (which isn’t clickable by default) that has the following conditionals…

(Note that the filter on the second conditional has a constraint where Creator = Current User, and this conditional is used to stop the user from submitting more than one prediction per contest.)

  • A text element that displays a user’s prediction after it has been submitted (Parent Group's Contest's predictions list:filtered's minutes to complete job, with the constraint on the filter again being Creator = Current User)
  • A text element (which is not visible on page load) that displays a congratulatory message when the following condition is met…

congatulations

Anyway, that’s what I’ve got, and I hope it’s helpful.

Best…
Mike

@mikeloc Awesome Mike :+1: you have done it in an easier fashion to what i have done to solve this problem. But i finally succeeded in arriving at the solution by making use of backend api as at that time I don’t have much knowledge about how to deal with situations that has aome time constraints in it now i jave two powerful tools to deal these type of situations:

  1. Scheduling an event using backend api
  2. To change things every 1 second.

But i am very curious to know now which method on should prefer between these two are they really same in dealing situations like this or there’s still a difference which i should be aware of.

Btw thank you so much Mike for you time and effort you put to solve the problem.

This topic was automatically closed after 70 days. New replies are no longer allowed.