MozillaZine

Order is random for events with same times - Sunbird Lightning Calendar

From MozillaZine Knowledge Base

Issue: The order of events with the same times in different calendars is random. This is particularly an issue in Day view or Week View: When calendars are different colors, and multiple calendars with events with the same times are viewed together (such as schedules of classes or conference sessions), the events appear as a random checkerboard rather than as columns of the same color, and editing an event changes the order.

Versions:

  • Mozilla platform 1.8
    • Sunbird 0.5 (not 0.3.1), 0.7 – 0.9.
    • Thunderbird 1.5, 2.0 with Lightning 0.1 – 0.9.

Background:

  • This is a regression from Sunbird 0.3.
  • In Mozilla platform 1.8, Array.sort uses an unstable sort algorithm: quick sort.
  • In Mozilla platform 1.9, Array.sort uses a stable sort algorithm: merge sort.
  • Sunbird 0.3 uses Mozilla platform 1.9.
  • Sunbird 0.5 and 0.7 – 0.9 use Mozilla platform 1.8 (like Thunderbird 2.)
  • bug 224128 Javascript: Array.sort isn't a stable sort (switch to MergeSort)
  • bug 353091 Sunbird: Multiday view: calendar order not preserved, randomizing events at same time (need stable sort)

Workaround:

  • Use a Mozilla platform 1.9 build:
    • Sunbird 1.0pre (experimental)
    • Thunderbird (Shredder) 3.0a3 with Lightning 1.0pre (experimental!)