Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Status: New
Owner: ----
Labels: Milestone-1.3 Type-Bug

New issue 4840 by [hidden email]: Schedule>>between:and:do can iterate  
over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

If the start date sent to #between:and:do is a different day of the week  
than the start date of the schedule, #between:and:do outputs different  
dates than probably expected.




1.  run this failing test:
ScheduleTest>>testDaysOfWeekAreConsistent
  | originalDayOfWeekSet modifiedDayOfWeekSet start end  |
  originalDayOfWeekSet :=(aSchedule dateAndTimes collect:[:each | each  
dayOfWeek]) asSet.
  start:=DateAndTime year: 2003 month: 1 day: 5 hour: 20 minute: 30.
  end:=DateAndTime year: 2003 month:6 day: 4 hour: 20 minute: 30.
 
  modifiedDayOfWeekSet := OrderedCollection new.
  aSchedule between: start and: end do:[:eachStart | modifiedDayOfWeekSet  
add: eachStart dayOfWeek ].
 
  self assert: originalDayOfWeekSet equals: modifiedDayOfWeekSet asSet.
       
       
       
       
2. Change Schedule>>between:and:do to:
between: aStart and: anEnd do: aBlock
  "from Cuis 99"
 
  | element end i startDate |
  end := self end min: anEnd.
       
  element := self start.
  "Performance optimization. Avoid going through unnecesary days if easy."
  startDate := aStart asDate.
  (startDate > element asDate and: [ self everyDayAtSameTimes ]) ifTrue: [
   element := DateAndTime date: startDate time: element asTime ].
       
  i := 1.
  [ element < aStart ] whileTrue: [
   element := element + (schedule at: i).
   i := i + 1.
   i > schedule size ifTrue: [i := 1]].
       
  [ element <= end ] whileTrue: [
   aBlock value: element.
   element := element + (schedule at: i).
   i := i + 1.
   i > schedule size ifTrue: [i := 1]].
       
The proposed change prevents the iteraring temp var i from being reset to 1  
after the [ element < aStart ] whileTrue: [...] block.  
       
3. Run the test above and it passes.  As do all the other schedule tests.  



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: ReviewNeeded
        Labels: Milestone-1.4

Comment #1 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo

Comment #2 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

Next Action: Attach code in a form that is machine readable (SLICE or .cs)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: Workneeded

Comment #3 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo

Comment #4 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

And if someone asks why: copy and past looses from this website loses all  
indentation.
This means that one needs to hand-touch *every* *single* *line* *of* *code*.




_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo

Comment #5 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

oof.  That sounds annoying.  I've uploaded the slice.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: FixReviewNeeded

Comment #6 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: Workneeded

Comment #7 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

I can not merge the SLICE in 1.3.






_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo

Comment #8 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

maybe just file put the two methods and attach them? then it's done.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo

Comment #9 on issue 4840 by [hidden email]: Schedule>>between:and:do  
can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

here are the file outs.

Attachments:
        Schedule-betweenanddo.st  908 bytes
        ScheduleTest-testDaysOfWeekAreConsistent.st  793 bytes


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: FixReviewNeeded

Comment #10 on issue 4840 by [hidden email]:  
Schedule>>between:and:do can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: FixToInclude

Comment #11 on issue 4840 by [hidden email]:  
Schedule>>between:and:do can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

change set attached that does not change the category of the methods.

The change set can be loaded in 1.3 and 1.4

Attachments:
        ScheduleFixes.1.cs  2.0 KB


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo

Comment #12 on issue 4840 by [hidden email]:  
Schedule>>between:and:do can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

in 14256

TODO: 1.3


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: Integrated

Comment #13 on issue 4840 by [hidden email]:  
Schedule>>between:and:do can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

in 13321


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: FixToInclude

Comment #14 on issue 4840 by [hidden email]:  
Schedule>>between:and:do can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

Nope, reverted as I could not publish


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Labels: -Milestone-1.4

Comment #15 on issue 4840 by [hidden email]:  
Schedule>>between:and:do can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4840 in pharo: Schedule>>between:and:do can iterate over the wrong dates.

pharo
Updates:
        Status: Integrated
        Labels: Milestone-1.4

Comment #16 on issue 4840 by [hidden email]:  
Schedule>>between:and:do can iterate over the wrong dates.
http://code.google.com/p/pharo/issues/detail?id=4840

in 13321


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker