I've convinced myself to store the duration as an integer (minutes).
Creating a template filter to display 65 minutes as 1:05 is likely
possible - don't know how to yet, but looking.
Best so far appears to be:
http://monmonja.com/blog/2008/09/templatetags-on-app-engine/



On Oct 1, 2:42 pm, macgillivary <[email protected]> wrote:
> I've got a small time entry app on the go (or about to be on the go).
>
> Summarized I have a timecard model and an journal model. The time card
> model stores the startdatetime, enddatetime, and through the workflow
> process, once time is approved, rate calculated etc, the journal table
> gets populated with a duration and dollar value total for a particular
> shift (or particular pay period - I haven't quite decided - I'm
> thinking ahead to limits of 1000 results for year end queries) once
> the pay period is closed by the payroll administrator.
>
> class Timecard(db.Model):
>     startdatetime = db.DateTimeProperty()
>     enddatetime = db.DateTimeProperty()
>     employee = db.ReferenceProperty(Employee)
>     earnings = db.ReferenceProperty(Earnings) #sick/regular/overtime/
> vacation etc
>     notes = db.TextProperty()
>
> class Journal(db.Model):
>     employee = db.ReferenceProperty(Employee)
>     payperiod = db.ReferenceProperty(Payperiod)
>     earnings = db.ReferenceProperty(Earnings)
>     totaltime = db.TimeProperty()
>
> I'm questioning as to whether it is better to store the totaltime as a
> TimeProperty, or as an integer in minutes. Since it represents a time
> (hours and minutes) I thought it would be better to represent it as
> such, but trying to display such a duration of 00:15:00 with a
> totaltime|time:"g:i" in the templates shows a 12:15.  If I store it as
> 15 minutes (integer) I need a custom tag of sorts (I think) to display
> 65 minutes as 1:05. While displaying the template, I'm also adding up
> the totaltime (and dollars) for a total at the bottom of the table for
> the results.
>
> Continuing to plug along, but thought I'd throw this out there in the
> case someone had some best practice knowledge in this area. Appreciate
> any feedback - first real app with the datastore and still struggling
> now and again reading documentation on as needed basis.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to