From 32f0336643e045587fca0b513564ee68f6f801ab Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 18 十二月 2024 15:42:30 +0800
Subject: [PATCH] 日历不可用时间报表优化

---
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl |   40 +++++++++++++++++-----------------------
 1 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
index 1171045..abd3094 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
@@ -7,27 +7,21 @@
   TextBody:
   [*
     // 鐢勫叞楦� May-28-2024 (created)
-    rownr                 := this.LibCal_SubscriberEventRow( relsize );
-    
-    traverse( subscribers, Elements, subscriber ){
-    
-      traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory().Name() = 'Unavailable' ){
-        event := participation.Event();
-        
-        row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID() 
-                             and row.Event() = event.Subject() 
-                             and row.EventType() = guard( event.EventType().Name(), '' )
-                             );
+    //rownr                 := this.LibCal_SubscriberEventRow( relsize );
+    traverse( this.LibCal_Calendar(), Event.LeadingParticipation, lp, lp.Event().EventCategory().Name() = 'Unavailable' ){
+      event               := lp.Event();
+      rows                := selectset( this, LibCal_SubscriberEventRow, row, row.Event() = event.Subject() and row.EventType() = guard( event.EventType().Name(), '' ) );
+      traverse( lp, Subscription, subscription ){
+        row               := selectobject( rows, Elements, row, row.Subscriber() = subscription.Calendar().CalendarID() );
         
         if( isnull( row ) ){
-          row := this.LibCal_SubscriberEventRow( relnew, RowNr := rownr, Subscriber := subscriber.CalendarID(), 
-                                                 Event := event.Subject(), 
-                                                 EventType := guard( event.EventType().Name(), '' ) );
+          row             := this.LibCal_SubscriberEventRow( relnew, Subscriber   := subscription.Calendar().CalendarID()
+                                                             , Event              := event.Subject()
+                                                             , EventType          := guard( event.EventType().Name(), '' ) );
           
-          rownr := rownr + 1;
         }
         
-        traverse( participation, ExplicitTimeInterval, eti ){
+        traverse( subscription, ExplicitTimeInterval, eti ){
           row.InitializeDate( this, eti.Start(), eti.End(), event.Description() );
         }
     
@@ -37,13 +31,13 @@
     //traverse( this, LibCal_SubscriberEventColumn, column ){
     //  info( '------------------------', column.Name(), column.Period(), column.TimeUnit() );
     //}
-            
-    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxDayDate ) );
-    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxWeekDate ) );
-    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxMonthDate ) );
-    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinDayDate ) );
-    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinWeekDate ) );
-    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinMonthDate ) );
+    //        
+    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxDayDate ) );
+    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxWeekDate ) );
+    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxMonthDate ) );
+    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinDayDate ) );
+    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinWeekDate ) );
+    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinMonthDate ) );
     this.ProcessColumnDay();
     this.ProcessColumnWeek();
     this.ProcessColumnMonth();

--
Gitblit v1.9.3