Chris Kavanagh wrote:

> Dear List,
> 
> So tasks in my task management system include these fields:
> 
> deadline              (date - MySQL "date")
> leadtime              (number - MySQL "tinyint")
> leadtime_type (minutes, hours, days, weeks - MySQL "varchar")
> 
> On the "task list" view (an html table), I'd like the table rows to 
> change colour based on how close the deadline is.

Oh, and alternatively you could use an INTEGER UNSIGNED column in
leadtime and get rid of leadtime_type instead, and normalise all the
values to minutes. The bonuses would be that you'd be able to store
values of greater magnitude than your current scheme (it stores 32-bit
numbers), and each of the rows would take up less space.

Also, this simplifies implementing your task list. It's just a matter of
getting the difference between deadline and Now() in minutes, and
comparing that to the value in leadtime. If you want all the work done
in SQL, you could use as CASE statement for deciding how the table rows
should be denoted.

K.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192524
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to