Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

architecture question

I have a request to build a one page time reporting form that allows a user to select any Sunday of the year.  Once they have selected a Sunday, they should be shown a table with 7 columns representing the days of their selected week; each column should have an input to allow the user to enter the number of hours they worked that day.  Upon save the user records are stored in the database.

I already have a a user table, but I need to create a table for the time reporting.  I should have one table for the days of the week....i.e. Sunday thru Saturday with a foreign key relationship to the user, but I'm a little thrown by the any Sunday of the year selection?  How should that be handled?  How should I capture that in the database (another table)?  Also, how would I allow the user to only select a Sunday out of the year?  I can have a calendar popup, but I'm not quite sure how to only allow the Sundays of the year be selected.

Any suggestions or better ideas on the table construction would be helpful?

Thanks.
0
-Dman100-
Asked:
-Dman100-
  • 3
1 Solution
 
HainKurtSr. System AnalystCommented:
I use datetime

userid: varchar, workday: date, hours:double

or use this

userid: varchar, weekno: int, day1, day2, day3, day4, day5, day6, day7: double

think which one is better for your app
0
 
HainKurtSr. System AnalystCommented:
oops, we need to add a year to second option as

userid: varchar, year:int, weekno: int, day1, day2, day3, day4, day5, day6, day7: double
index: userid, year, weekno

for first option
index: userid, workday
0
 
HainKurtSr. System AnalystCommented:
if you will work with weeks all the time, 2nd option is better... 1/7 of records will be in db compared to 1st opt

if you work with individual day then 1st option is better...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now