Ticket #704 (new defect)

Opened 14 years ago

Last modified 13 years ago

EventDoc on further months doesn't display

Reported by: patrick.herve@… Owned by: trac
Priority: P2 Milestone:
Component: CPSDefault Version: CPS 3.2 branch
Severity: minor Keywords: calendar month display
Cc:

Description (last modified by fguillaume) (diff)

In CMFCalendarToolPatch.py there is a search function use in the catalog_getcpsevents method. The parameters in the search funtion are set to retrieve Events only include into the current months (begining AND starting in the same month).

I want to display Events which begin in the current and ending in the current month too.

So I done the code bellow in order to have a good display of Events on further month.

I replace this :

    #query = self.search(query={'portal_type':final_event_types,
    #                           'review_state':'published',
    #                           },
    #                    folder_prefix=location,
    #                    start_date=first_date,end_date=last_date)

by this :

    query1 = self.search( query=
                                {
                                 'portal_type':'EventDoc',
                                 'review_state':'published',
                                }, 
                                folder_prefix='/', 
                                start_date=first_date,
                                
                            )
    
    
    query2 = self.search( query=
                                {
                                 'portal_type':'EventDoc',
                                 'review_state':'published',
                                }, 
                                folder_prefix='/', 
                                
                                end_date=last_date
                            )
    query_b =[]
    query_o =[]
    
    for q in query1:
     res = q.getObject().getContent()
     query_b.append(q)
     query_o.append(res)
    
    for q in query2:
     res = q.getObject().getContent()
     if int(str(res.end).split('/')[1])==int(month):
      if res not in query_o:
       query_b.append(q)
       query_o.append(res)
    
    query=query_b

Change History

comment:1 Changed 14 years ago by anonymous

I made a mistake , this is better :

query1 = self.search( query=

{

'portal_type':'EventDoc?', 'review_state':'published',

}, folder_prefix='/', start_date=first_date,

)

query2 = self.search( query=

{

'portal_type':'EventDoc?', 'review_state':'published',

}, folder_prefix='/',

end_date=last_date

)

query_b =[] query_o =[]

for q in query1:

res = q.getObject().getContent() if int(str(res.start).split('/')[1])==int(month):

query_b.append(q) query_o.append(res)

for q in query2:

res = q.getObject().getContent() if int(str(res.end).split('/')[1])==int(month):

if res not in query_o:

query_b.append(q) query_o.append(res)

query=query_b

comment:2 Changed 14 years ago by fguillaume

  • Description modified (diff)

Could you explain in a bit more detail what's wrong, according to you, with the current behaviour? I don't understand the difference between:

Events only include into the current months (begining AND starting in the same month)

and

Events which begin in the current and ending in the current month too

comment:3 Changed 14 years ago by fguillaume

  • Milestone changed from unspecified to CPS 3.2.5

comment:4 Changed 14 years ago by fguillaume

The calendar is deprecated in 3.4, this may be useful for the 3.2 branch.

comment:5 Changed 13 years ago by root

  • Milestone CPS 3.2.5 deleted

Milestone CPS 3.2.5 deleted

Note: See TracTickets for help on using tickets.