1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Time Element storing "hours" in "seconds"

Discussion in 'Professional Support' started by bggann, Sep 13, 2018.

  1. bggann

    bggann Member

    Level: Community
    I'm using the time plugin (field) extensively in my aviation forms - and sometimes (intermittent) it stores the "hours" as "seconds" in the database. This seems to only happen on one form/group/field.
    This plugin stores time as a string "hh:mm:ss" and in the failed cases it is storing "00:00:hh"

    In all cases, I'm setting the format for list and for details as 'hh:mm' meaning I do not enter or record seconds.
    Recording to 15 minute increment
    Separator ":"
    24 hr dropdown
    Enhance Dropdown no
    All other things are default.

    In one case, it seems to be working fine.
    In a second case (same element, but in different group and NOT child) it is, sometimes, recording the "hours" as "seconds" in the database.
    I'm calculating (ajax and on save) the number of hours between times - and that is correct, so at AJAX and on save, they are correct. Otherwise I could not calculate based on them. But, if you look at the database (php admin), the data is stored correctly.

    For example:
    Start time: "10:00:00"
    Stop time: "00:00:00" <- midnight
    Hours: 14 <- correct, 10am to midnight is 14 hours.

    In the database is stored
    Start Time: "00:00:10"
    Stop Time: "00:00:00"
    Hours: 14

    Note - the hours in the database is correct. So the calculation I do for hours is working - which means the data I get from the placeholders is correct. (I parse the string).

    This is working on one instance of the time plugin, but not the other (in a different group).
    The names of the working are the same, but they are not parent/child.

  2. bggann

    bggann Member

    Level: Community
    Bump - any ideas?
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community

    So from you description, it's not consistent? It does this "sometimes", not all the time?

    -- hugh
  4. bggann

    bggann Member

    Level: Community
    Yes - unfortunately. It is intermittent.
    Here is SQL query output from the database.
    Note - availability_hours is a calculated field that is calculated from availability_start and availability_stop.
    For a day where the availability runs from 10:00 to midnight, that is 14 hours. Since it is a calc field based on the start and stop - that tells me it was correct in the fields on submission.
    Notice from the dates - that this has been happening for a while. most recent was 9/25 - as in today.
    The only 'HINT' I have is that I never see this on Helicopters or SEATs, only the MMA aircraft type. The availability_start and _stop elements are parent/childs for the heli's and SEAT's, but independent elements for the MMA. All instances write to the same database columns.
    But that may be a red herring because the Helicopters and SEATs can't be available from 10am to midnight (they don't fly after dark), so it may just be they are not being entered at from 10:00:00 to 00:00:00
    Last edited: Sep 25, 2018
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I spent a while going through that code and testing various scenarios, but I cant yet see a condition that would cause that to happen.

    I'll carry on trying. But as usual, I can only fix something if I can replicate it. If you can do some testing and see if there's any way you can replicate it, that'd help.

    I thought I might have been on to something with a condition that occurs after a validation failure, where the value won't be an array, it'll be a string, but alas ... the code already accounts for that.

    -- hugh
  6. bggann

    bggann Member

    Level: Community
    Yeah - I know. It is very frustrating. I'm wondering if it has to do with the 'midnight' nature - but it is the 10am one that is failing. I see it happening, but I can't come up with a particular sequence. I'll also look to see if it is a particular user. Didn't think of that one.


Share This Page