PPL

editing a story resets the date to 0

Bug #723558 reported by Christopher Adams
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PPL
Fix Released
Critical
Brad Phillips

Bug Description

When the Owner creates a story and then edits it, then both the created_at_date and updated_at fields get reset to 0000-00-00 00:00:00.

Changed in ppl:
status: New → Confirmed
importance: Undecided → Critical
milestone: none → 0.3
description: updated
Revision history for this message
Christopher Adams (christopheradams) wrote :

The ppl_stories form (#25) contains:

autofield updated_at|People:updated at:datetime

autofield created_at_date|People:upload created_at:datetime

Questions:

How are these supposed to work?

Why is created_at_date being changed??

Revision history for this message
Christopher Adams (christopheradams) wrote :

Who can tackle this? Aiki bug or just something wrong with the form?

description: updated
Changed in ppl:
status: Confirmed → Fix Released
Revision history for this message
Brad Phillips (brad-bradphillips) wrote :

I was able to get this working by, first, adding a new form to the ppl_stories table (form 39: ppl_story_edit). This form is called in the story_edit widget (instead of the original form 25).

To stop the creation date from being messed with, I simply removed the field from the aiki form (so that date couldn't be overwritten in the new form). I had to test a few different solutions for the update date, but was finally able to arrive at a solution by doing the following:

-I noticed the update date was being addressed twice on the form (once to insert into ppl_stories & again into ppl_logs) & I knew that aiki was capable of inserting 1 value into 2 tables at the same time, so I deleted the autofield|updated_at field & changed the 2nd instance to the following code:

"autofield"=>"created_at->ppl_logs|SystemGOD:created at:datetime:[updated_at]"

The [updated_at] on the end successfully inserts the datetime into table 1 & the "created_at->ppl_logs" continues to successfully update the 'created_at' field in ppl_logs.

Changed in ppl:
assignee: nobody → Brad Phillips (brad-bradphillips)
Revision history for this message
Christopher Adams (christopheradams) wrote : Re: [Bug 723558] [NEW] editing a story resets the date to 0

Can you confirm that created_at is only set once when the story is created?

It's also possible to have the updated_at set automatically by the
database whenever the record is changed. Ue phpmyadmin to set this.

On Saturday, February 26, 2011, Brad Phillips <email address hidden> wrote:
> I was able to get this working by, first, adding a new form to the
> ppl_stories table (form 39: ppl_story_edit).  This form is called in the
> story_edit widget (instead of the original form 25).
>
> To stop the creation date from being messed with, I simply removed the
> field from the aiki form (so that date couldn't be overwritten in the
> new form).  I had to test a few different solutions for the update date,
> but was finally able to arrive at a solution by doing the following:
>
> -I noticed the update date was being addressed twice on the form (once
> to insert into ppl_stories & again into ppl_logs) & I knew that aiki was
> capable of inserting 1 value into 2 tables at the same time, so I
> deleted the autofield|updated_at field & changed the 2nd instance to the
> following code:
>
> "autofield"=>"created_at->ppl_logs|SystemGOD:created
> at:datetime:[updated_at]"
>
> The [updated_at] on the end successfully inserts the datetime into table
> 1 & the "created_at->ppl_logs" continues to successfully update the
> 'created_at' field in ppl_logs.
>
> ** Changed in: ppl
>     Assignee: (unassigned) => Brad Phillips (brad-bradphillips)
>
> --
> You received this bug notification because you are a member of PPL
> Developers, which is subscribed to PPL.
> https://bugs.launchpad.net/bugs/723558
>
> Title:
>  editing a story resets the date to 0
>
> Status in PPL:
>  Fix Released
>
> Bug description:
>  When the Owner creates a story and then edits it, then both the
>  created_at_date and updated_at fields get reset to 0000-00-00
>  00:00:00.
>

Revision history for this message
Brad Phillips (brad-bradphillips) wrote :

Yes, confirmed that created_at in the ppl_logs table is only inserted once on a stories creation. I could change that form to work in the same way as form 2 (where only one field does the inserting in both tables), but it's working ok in this instance. I don't think it's necessary to use phpmyadmin as aiki seems to be working as expected with the date creation & updates now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.