Modify

Opened 6 years ago

Closed 6 years ago

#4929 closed defect (fixed)

Sample report does not work with PostgreSQL 8.3

Reported by: christian@… Owned by: vnaum
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 6 years ago by vnaum

  • Resolution set to fixed
  • Status changed from new to closed

Thanks, Christian!

Fixed in revision 5523.

Add Comment

Modify Ticket

Action
as closed The owner will remain vnaum.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.