Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event sort works incorrect in Month View #7185

Closed
chuckn0rris opened this issue Jul 19, 2023 · 1 comment
Closed

Event sort works incorrect in Month View #7185

chuckn0rris opened this issue Jul 19, 2023 · 1 comment
Assignees
Labels
bug Something isn't working forum Issues from forum high-priority Urgent to have fixed OEM OEM customer premium resolved Fixed but not yet released (available in the nightly builds)
Milestone

Comments

@chuckn0rris
Copy link

Forum post

According to docs here https://bryntum.com/products/calendar/docs/api/Calendar/util/EventSorter#function-defaultSorterFn-static
Sorting should be by startDate
_This sorting method implement following rules:

Unscheduled events go before scheduled ones
Compare by floored start date
If equal, compare by floored duration
If equal, compare by start date
If equal, compare by duration_

In fact it's sorted by duration. See Breakfast is after Lunch and DInner
Screenshot 2023-07-19 at 09 49 08

@chuckn0rris chuckn0rris added bug Something isn't working premium forum Issues from forum OEM OEM customer labels Jul 19, 2023
@matsbryntse matsbryntse added the high-priority Urgent to have fixed label Jul 19, 2023
@ExtAnimal
Copy link

Fix is this in EventSorter.js:

    static interDaySorterFn(event1, event2) {
        // Handle event wrapping which is what MonthView does.
        event1 = event1.eventRecord || event1;
        event2 = event2.eventRecord || event2;

        const
            {
                startDate  : start1,
                isInterDay : event1InterDay
            } = event1,
            {
                startDate  : start2,
                isInterDay : event2InterDay
            } = event2;

        // Unscheduled events sort to the top.
        if (!start1) {
            return -1;
        }
        if (!start2) {
            return 1;
        }

        // InterDay events sort to the top (https://github.com/bryntum/support/issues/1693).
        if (event1InterDay !== event2InterDay) {
            return Number(event2InterDay) - Number(event1InterDay);
        }

        // If both events fit inside one day cell, the only sort order we care about is start time.
        if (!event1InterDay && !event2InterDay) {
            return start1 - start2;
        }

        // Sort Duration (longest first), then by ending date (furthest in future first), then by start timestamp.
        // This is *in-cell* sorting.
        return event2.durationMS - event1.durationMS || event2.endingDate - event1.endingDate || start1 - start2;
    }

@matsbryntse you could take this one.

@mazzafabio mazzafabio self-assigned this Jul 19, 2023
@mazzafabio mazzafabio added in progress ready for review Issue is fixed, the pull request is being reviewed labels Jul 19, 2023
@isglass isglass added this to the 5.4.2 milestone Jul 20, 2023
@isglass isglass added resolved Fixed but not yet released (available in the nightly builds) and removed in progress ready for review Issue is fixed, the pull request is being reviewed labels Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum high-priority Urgent to have fixed OEM OEM customer premium resolved Fixed but not yet released (available in the nightly builds)
Projects
None yet
Development

No branches or pull requests

5 participants