Solved

Automating timers

Posted on 2011-09-26
2
227 Views
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
0
Comment
Question by:oo7ml
[X]
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
2 Comments
 
LVL 13

Assisted Solution

by:Hugh McCurdy
Hugh McCurdy earned 150 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.
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 350 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.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

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

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

636 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