Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Automating timers

Posted on 2011-09-26
Medium Priority
Last Modified: 2012-05-12
Hi, my site allows people to buy e-learning courses for other people. As soon as a person receives and starts a course, they must complete daily tutorials every day for the period of the course.
Most courses take 2 weeks to complete, so this means the person will have to login and complete a tutorial every day for 2 weeks (14 days)

When a user logins to complete a tutorial each day, they will have to read several course notes and then at the end, they will have to complete a very easy interactive task, such as dragging a round ball and dropping it into a round hole. This small interactive task is very important as it marks the tutorial for that day as “complete” for that day. If they do not complete the interactive task, then the tutorial will not be completed for that day and they will fail the entire course.

Once a user has completed the daily tutorial, they cannot start the next (tomorrows) tutorial until the start of a new day (00:00) and they must complete each tutorial before the end of their day (23:59)

Considering users will be from different time zones, they must choose their timezone before starting their very first course. This will allow the site to calculate the start and end time of a user’s day.

My question is:
How should I create and automate this function so that the site can monitor and control the timing and completion of tutorials. I was thinking I need to add additional fields to the course table in the database such as:

$duration (the length of the course)
$start_date (the date the user starts the first tutorial of the course)
$end_date (the $start_date + ($duration (2 weeks) ))
$time_zone (this will be used to calculate the users time, in order to signify the start and end of their day)
$daily_status (incomplete, completed)

I am sure I need more fields, but first I need to establish how I can automate all of this

P.S – I am not worried about how I will automate what notes or interactive task need to be displayed and completed each day… I am only looking for help on how I can automate the time and completion of each tutorial each day, thanks in advance for your help
Question by:oo7ml
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 13

Assisted Solution

by:Hugh McCurdy
Hugh McCurdy earned 600 total points
ID: 36599292
I fear that I misunderstand the question.  This doesn't seem like automatic timing.

Related to control of access, the user will make page load requests throughout the day and the request will either be inside or outside the window (the day).  It's a simple comparison of the current to the boundary times for the daily window.

I am concerned about your data and what I view as a lack of flexibility.  

I would expand the daily status to an array of size 14 so that you can track each day.  Instead of just complete/incomplete, perhaps you should record the date and time it was completed.  I would also avoid hard coding 14 to much into the code especially considering that PHP is loosely typed.  At some point, someone may ask you to setup a 10 day or 21 day class.

Another, and I think more important, flexibility concern is that people have lives and things happen in those lives.  While you can state the rule that they must complete the tutorial, once per day for 14 days in a row, I think that plan is going to get you into trouble with unhappy customers, lost business, etc.

One simple observation is that some people's beliefs prevent them from working on a particular day of the week or on certain holidays.  How many Christians are going to schedule the tutorial if the 14 days spans Good Friday and Easter?  If nothing else, the strict plan creates a revenue hole based on the calendar.

Another problem is that, because people have lives, surprise events happen.  People get sick.  Do you really want to deal with a mother who completed 13 sessions but on the 14th day her daughter ended up in the emergency room?  Of course, she's going with her daughter to the ER.

What if the student encounters a power failure that lasts several hours and is truly unable to take the class one day because of it?  Or what if there's a hurricane and much of the east coast of the US evacuates?  (Or Katrina in New Orleans a few years ago?)

You customers will have good reasons and will almost certainly become angry with you if you don't accept those good reasons.  Even if you want to accept the good reason, your software design doesn't yet accommodate.  

Part of the solution is to track each day as an independent event (the "14" element array).  Another is to not insist (include a test) that day 13's work has to actually be done on day 13 but that it could be done on day 15.
LVL 111

Accepted Solution

Ray Paseur earned 1400 total points
ID: 36599387
You can learn the way to handle the DATETIME things from this article.  Clients in different time zones are a fairly common issue.

Please read that over and then post back with any specific questions.

Featured Post

Stack Overflow Podcast - Developer Story

Welcome to the Stack Overflow podcast recorded Thursday July 20 at Stack Overflow Headquearters in NYC. Your hosts today are podcast regulars Jay Hanlon, David Fullerton, and Ilana Yitzhaki, plus the quite irregular Matt Sherman (Stack Overflow Engineering Manager extraordinaire)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question