#3655 closed defect (fixed)
Sample report to sort tickets by the number of votes
Reported by: | anonymous | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | VotePlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.10 |
Description
Provide some sample SQL report which allows to sort the tickets according to the number of votes, also displaying the number of votes.
I don't know the database fields which are introduced by the voteplugin ...
Attachments (0)
Change History (9)
comment:1 Changed 16 years ago by
comment:2 follow-up: 3 Changed 16 years ago by
I'd vote for this ticket. BTW the SQL query above doesn't work. When I save it trac displays: ERROR: column "p.value" must appear in the GROUP BY clause or be used in an aggregate function
comment:3 Changed 16 years ago by
Replying to mauzer_tim:
I'd vote for this ticket. BTW the SQL query above doesn't work. When I save it trac displays: ERROR: column "p.value" must appear in the GROUP BY clause or be used in an aggregate function
I wrote the query for
Trac | 0.11.2.1 |
Python | 2.5.2 |
SQLite | 3.3.4 |
It works for me, so maybe it's a configuration difference.
comment:4 Changed 16 years ago by
Here's the query I used with PostgreSQL:
SELECT p.value AS __color__, id AS ticket, summary, component, version, milestone, t.type AS type, owner, status, votes, changetime AS _changetime, description AS _description, reporter AS _reporter FROM ticket t LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' join (select resource, sum(vote) as votes from votes group by resource) as v ON (v.resource = 'ticket/'||t.id) WHERE status <> 'closed' ORDER BY votes DESC, p.value, time
comment:5 Changed 14 years ago by
Owner: | changed from Alec Thomas to Ryan J Ollos |
---|
Reassigning ticket to new maintainer.
comment:6 Changed 14 years ago by
Summary: | Provide sample report (SQL) → Sample report to sort tickets by the number of votes |
---|
This report exists on t.e.o: t:report:34
comment:7 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:9 Changed 12 years ago by
(In [13080]) VotePlugin: Update sample SQL reports following changes in [13079], refs #3655.
Here's a basic SQL query that should return all the tickets that have been voted on sorted by the total number of votes. I'm not a SQL expert, so perhaps this can be improved or simplified.