Modify

Opened 16 years ago

Closed 16 years ago

#4929 closed defect (fixed)

Sample report does not work with PostgreSQL 8.3

Reported by: christian@… Owned by: Vladislav Naumov
Priority: normal Component: TracUnreadPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

The included sample report does not work with pg 8.3 as integers are no longer automaticly cast to varchars. I have made two minor changes to make it work with 8,3:

	SELECT p.value AS __color__,
 	   (CASE status WHEN 'assigned' THEN 'Assigned' ELSE 'Owned' END) AS __group__,
 	   t.id AS ticket, summary, component,
 	   priority, time AS _created,
 	   changetime AS modified,
 	   reporter AS _reporter
 	   , CASE
 	    WHEN u.last_read_on IS NULL OR u.last_read_on < t.time
 	    THEN '[ticket:' || cast(t.id as varchar) || ' new ticket]'
 	    WHEN u.last_read_on > t.changetime
 	    THEN 'no unread'
 	    ELSE '[comment:ticket:' || cast(t.id as varchar) || ':' || (
 	        -- fetch unread comment number
 	        SELECT
	          CASE
 	            -- Thanks for recording parent.child relationship, guys!
 	            WHEN position('.' in oldvalue) != 0 THEN split_part(oldvalue, '.', 2)
 	            ELSE oldvalue
 	          END
 	        FROM ticket_change tc
 	        WHERE field = 'comment'
 	          AND ticket = t.id
 	          AND time > u.last_read_on
 	        ORDER BY time
 	        LIMIT 1
	      ) || ' unread comment]'
	    END
 	    AS description
 	
 	  FROM ticket t
 	  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
 	  LEFT JOIN trac_unread u ON (u.id=t.id
 	    AND u.type = 'ticket'
 	    AND u.username = '$USER'
 	  )
 	  WHERE t.status IN ('new', 'assigned', 'reopened') AND owner = '$USER'
 	  ORDER BY description, CAST(p.value AS integer), milestone, t.type, time

Also please note that I changed the order by clause to reflect my needs.

Otherwise: Great plugin - thx

Attachments (0)

Change History (1)

comment:1 Changed 16 years ago by Vladislav Naumov

Resolution: fixed
Status: newclosed

Thanks, Christian!

Fixed in revision 5523.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Vladislav Naumov.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.