I finaly found the problem witch was not in the code suggest but behind the keyboard.
In fact when the time is generated everything is good , when i entered it by hand = this is a String. So I had in the sorting code:
^notes sort:[:a :b | (a date = b date) and:[a temps asTime > b temps asTime ]] .
Le 2015-02-04 à 14:40, Chris Cunningham cunningham.cb@gmail.com a écrit :
You have a logic issue with the first one: sortedNotes ^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] . This is saying that the the two dates are different, then false. For this you probably want to be something like: sortedNotes ^notes sort:[:a :b | a date > b date or: [(a date = b date) and:[a temps > b temps]]] .
-cbc
On Wed, Feb 4, 2015 at 10:22 AM, Raymond Asselin <jgr.asselin@me.com mailto:jgr.asselin@me.com> wrote: For now I implemented:
sortedNotes ^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
AND
notesSorted ^notes sort:[:a :b | a date = b date ifTrue:[a temps > b temps] ifFalse:[a date > b date]] .
does exactly the same result.
But there is still notes in a same date that do not sort correctly, the begining is good and after 5 or so objects I get some witch do not seem to be sorted.
BTW don't know the difference between sort: and sorted: it seems as if the last one produce a new collection and the first one produce same collection but sorted.
Note: I use 24 hours instead of a.m. / p.m. is this may cause problems?
Le 2015-02-04 à 12:00, Paul DeBruicker <pdebruic@gmail.com mailto:pdebruic@gmail.com> a écrit :
a date = b date ifTrue:[a temps > b temps] ifFalse:[a date > b date]
Beginners mailing list Beginners@lists.squeakfoundation.org mailto:Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners