time - ruby hours and minutes -
i need store time log employees. need know spent, example, 20 minutes working on project , 1 hr 30 minutes working on project b.
before run migration, i'd understand best practice storing sort of information. don't need know date or time don't want date / time calculations of duration. user-entered hours , minutes. however, have calculations @ point. employee mentioned above did total of 1hr 50 minutes.
i going create 2 integer fields. 1 hours , 1 minutes, , deal calculations later. make sense, or making mistake @ first hurdle?
thanks
just store duration in seconds integer value.
you can use chronic gem if want parse human input actual durations, example convert "1 hour , 40 minutes" 100 minutes or 6000 seconds.
Comments
Post a Comment