Menu ▾ ▴

#178 Bug with calculating day value

1.3b
open
5
2006-12-13
2006-12-04
No

To reproduce:

1. Restore defaults.
2. Edit first event so that it starts several months in advance.
3. Create a new event that occurs just before the second event.

The newly created event will appear at the bottom of the list with a very high day value (edit it to view day value).

This is because the day value is calculated from the first event. EG: The day that the new event starts is X days from when the first event starts.

Basically, all the other starting day positions are outdated.

Discussion

  • Michael Penney

    Michael Penney - 2006-12-08

    Logged In: YES
    user_id=852849
    Originator: NO

    Can we fix it so the behavior is:

    New events have the same day value as the immediately previous event?

    So:
    Event 1 12/07/06
    Event 2 12/09/06

    Create new event:

    Event 1 12/07/06
    New Event 12/07/06
    Event 2 12/09/06

     
  • Mark Nielsen

    Mark Nielsen - 2006-12-08

    Logged In: YES
    user_id=1473408
    Originator: YES

    I don't think that would work very well. I think a better fix would be to update all day positions when the first event is edited. This is still tricky, but the only solution that comes to mind at the moment.

     
  • Michael Penney

    Michael Penney - 2006-12-12

    Logged In: YES
    user_id=852849
    Originator: NO

    How is this:

    "2. Edit first event so that it starts several months in advance."

    Being accomplished?

    When I restore defaults, and then change the date for the first event (on currentbuild), and click Submit, nothing happens (the date for the first event stays the same). How are you changing the date for the first event?

    When I click the edit function, I can put in a number for "Days from start:" but not edit the date.

    This revealed a second bug, when I put in a new number for "Days from start:" here:
    /currentbuild/blocks/teo_schedule/edit_event.php?id=3&eventid=342

    I get the below error

    Could not find first day activity

    along with a 'Found more than one record in get_record_sql !' error:

    Error: Turn off debugging to hide this error.

    SELECT e.id, e.timestart FROM mdl_event e, mdl_block_teo_schedule t WHERE e.id = t.eventid AND t.day = 0 LIMIT 100

    Found more than one record in get_record_sql !

    Array
    (
    [3] => Array
    (
    [id] => 3
    [0] => 1162737065
    [timestart] => 1162737065
    )

    [167] => Array
    (
    [id] => 167
    [0] => 1162737065
    [timestart] => 1162737065
    )

    [212] => Array
    (
    [id] => 212
    [0] => 1165212000
    [timestart] => 1165212000
    )

    [249] => Array
    (
    [id] => 249
    [0] => 1162737065
    [timestart] => 1162737065
    )

    [288] => Array
    (
    [id] => 288
    [0] => 1162737065
    [timestart] => 1162737065
    )

    [342] => Array
    (
    [id] => 342
    [0] => 1165816800
    [timestart] => 1165816800
    )

    [379] => Array
    (
    [id] => 379
    [0] => 1165903200
    [timestart] => 1165903200
    )

    [380] => Array
    (
    [id] => 380
    [0] => 1165816800
    [timestart] => 1165816800
    )

    )

    Changes saved

    ( Continue )

    Course:

    /currentbuild/course/view.php?id=3

    For the reported bug, it seems to me there should be no way to do this (without changing all event dates):

    "2. Edit first event so that it starts several months in advance."

    Perhas default dates should only be changed using "Suggest Dates". This seems like a usability issue, if you modify the first date, it should update all the other dates to match the new date.

    We should put some thought into the usability of this whole component. Perhaps the calendar should only go on the Edit Event page (blocks/teo_schedule/edit_event.php)--as it is when you add an event--why is it not there when you edit an existing event?, and that saving the events here should update the other subsequent events--pushing them all forward by the default value. Seems to me that this would:
    1) Fix the problem in the original bug
    2) Make it much more user friendly (don't have to update all the events individually when pushing one event forward a day).

     
  • Michael Penney

    Michael Penney - 2006-12-12
    • priority: 5 --> 8
     
  • Mark Nielsen

    Mark Nielsen - 2006-12-12

    Logged In: YES
    user_id=1473408
    Originator: YES

    Sounds like we need some feedback from John. The main problem with this block is that it provides a very simple function, a list of events and dates, but it has several complicated rules that are supposed to be enforced. These rules then sometimes break when doing some odd yet basic editing.

     
  • Michael Penney

    Michael Penney - 2006-12-13

    Logged In: YES
    user_id=852849
    Originator: NO

    How about the ''Found more than one record in get_record_sql !' error:'? Can we fix that and then turn the bug over to John for further comments?

     
  • Michael Penney

    Michael Penney - 2006-12-13
    • priority: 8 --> 5
     
  • Mark Nielsen

    Mark Nielsen - 2006-12-13

    Logged In: YES
    user_id=1473408
    Originator: YES

    > How about the ''Found more than one record in get_record_sql !' error:'?

    How did you do this? Sounds like there are two events with starting day of 0?

     
  • Michael Penney

    Michael Penney - 2006-12-13

    Logged In: YES
    user_id=852849
    Originator: NO

    I get it when I put in a new "Days from Start" value for an event in the "Setup Schedule" MT link on this course:
    currentbuild/course/view.php?id=3

     
  • Mark Nielsen

    Mark Nielsen - 2006-12-13

    Logged In: YES
    user_id=1473408
    Originator: YES

    In that course you somehow have multiple events with Days from start set to 1. I don't know how you did that. If I try to do it on my localhost, it tells me that only one event can have that day position.

     

Log in to post a comment.