Monday, September 10, 2018

Generate dynamic schedule for Rails application

Leave a Comment

I need to implement scheduling task for my application. Let's say application display popup questions fetching the schedule data from database.

Heres the database table structure -enter image description here

Now i want to display question's to logged in user from QuestionSchedule table. Heres the scenario - Question1 should displays X repeatable_times after each X repeat_after_days. Example - Question1 should displays 3 repeatable_times after each 2 repeat_after_days.

Note - UserQuestionAnswer should not display duplicate entry with calculate the UserQuestionAnswer and QuestionSchedule table.

Details data - Question (id-1, title- What is your level of confidence for todays task ?) QuestionSchedule(id-1,question_id-1,repeatable_times-3,repeat_after_days-2) UserQuestionAnswer(id-1,question_id-1,user_id-1,answer_at-(2018-08-27))

Now i want to generate schedule on fly -

2018-08-25 -> Schedule is created

2018-08-26 -> Should not display

2018-08-27 -> Should display and add answer to UserQuestionAnswer table not twice

2018-08-28 -> Should not display

2018-08-29 -> Should display and add answer to UserQuestionAnswer table not twice

2018-08-30 -> Should not display

2018-08-31 -> Should display and add answer to UserQuestionAnswer table not twice

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment