[Bps-public-commit] rtx-calendar branch multiple-days-events updated. 1.05-46-gbf0df78

BPS Git Server git at git.bestpractical.com
Tue Oct 17 13:44:04 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtx-calendar".

The branch, multiple-days-events has been updated
       via  bf0df78b8695c9bd0319c7b622d390c1538b041c (commit)
      from  d2fff9f8a875dfe5ae847d371b1710233cf7dad0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bf0df78b8695c9bd0319c7b622d390c1538b041c
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Tue Oct 17 10:41:49 2023 -0300

    Improve default event sorting algorithm
    
    Change the default event sorting code to use the Schwartzian transform
    technique, improving calendar loading performance.

diff --git a/etc/RTxCalendar_Config.pm b/etc/RTxCalendar_Config.pm
index 56631a0..0ac25dd 100644
--- a/etc/RTxCalendar_Config.pm
+++ b/etc/RTxCalendar_Config.pm
@@ -23,18 +23,12 @@ Set(@CalendarFilterStatuses, qw(new open stalled rejected resolved));
 Set(@CalendarFilterDefaultStatuses, qw(new open));
 
 Set($CalendarSortEvents, sub {
-    my $tickets_of_the_day = shift;
-    # This field is the first date field from the format attribute
-    # We receive it but it don't need to use it necessarily as in this
-    # example
-    my $sorting_field = shift;
-    my $current_user = shift;
-    my @sorted_tickets = sort {
-        $a_value = $a->id;
-        $b_value =  $b->id;
-        ($a_value cmp $b_value)
-    } @$tickets_of_the_day;
-    return @sorted_tickets;
+    my ( $tickets_of_the_day, $sorting_field, $current_user ) = @_;
+
+    return map  { $_->[0] }
+        sort { $a->[1] cmp $b->[1] or $a->[0] cmp $b->[0] }
+        map  { [$_,  $_->id ] }
+        @$tickets_of_the_day;
 });
 
 1;

-----------------------------------------------------------------------

Summary of changes:
 etc/RTxCalendar_Config.pm | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
rtx-calendar


More information about the Bps-public-commit mailing list