Modify

Opened 16 years ago

Closed 9 years ago

#4546 closed enhancement (fixed)

Macro to show vote lists in wiki pages

Reported by: Karsten Fuhrmann Owned by: Ryan J Ollos
Priority: normal Component: VotePlugin
Severity: normal Keywords:
Cc: Ryan J Ollos Trac Release: 0.11

Description

It would be very nice to have the possibility to show a list of voted objects based on a simple query, inside a wiki page (as a wiki macro).

queries could be a combination of :

  • type of resouce (ticket, wiki,attachment, milestone, ...)
  • votecount (minvotes, maxvotes, exactvotes)
  • filter a substring or regex of resourcename (e.g. all pages starting with "Trac")
  • order of appereance (asc, desc, alphabeticaly)
  • limit the output (e.g. limit like in sql)

So a macro could look like

[[ShowVotes(type=ticket, minvotes=5, limit=10, order=asc, filter='outdoor level')]]

Attachments (1)

CustomQueryFilterWithVotes.JPG (46.7 KB) - added by Jeremy Dunn 12 years ago.
please add Votes to ColumnList and Filter drop-down

Download all attachments as: .zip

Change History (16)

comment:1 Changed 15 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:2 Changed 15 years ago by vincenth

Would be very welcome, and really make VotePlugin complete!

comment:3 Changed 14 years ago by Ryan J Ollos

Owner: changed from Alec Thomas to Ryan J Ollos

Reassigning ticket to new maintainer.

comment:4 Changed 14 years ago by Ryan J Ollos

#4362 was a duplicate.

Changed 12 years ago by Jeremy Dunn

please add Votes to ColumnList and Filter drop-down

comment:5 Changed 12 years ago by Jeremy Dunn

I would also like such a feature very much.

Even a more basic capability to display vote-counts as a column in ticket queries would help ticket prioritization.

see the marked-up screenshot just attached, for the simple version.

comment:6 in reply to:  5 ; Changed 12 years ago by Jeremy Dunn

Replying to jeremydunn:

I would also like such a feature very much.

Even a more basic capability to display vote-counts as a column in ticket queries would help ticket prioritization.

see the marked-up screenshot just attached, for the simple version.

never mind. I figured out how to use custom query with outer join to 'votes' table.

Very basic report for open tickets, with net (sum) Votes column:

SELECT 
   id AS ticket, summary, component, version, milestone, severity,
   reporter AS _reporter,
  sum(v.vote) as netVotes
  FROM ticket t
    left outer join votes v 
    on v.resource="ticket/" || t.id
  where status <> "closed"
  group by id, summary, component, milestone, severity, reporter
  ORDER BY  milestone, severity, time

comment:7 Changed 12 years ago by Ryan J Ollos

Still, I like your original suggestion, since it would be useful for users that aren't proficient with SQL. I'm just not sure how to do it yet. Thanks for the bit of SQL as well, I might included that with the plugin at some point.

comment:8 in reply to:  6 Changed 12 years ago by Jeremy Dunn

Replying to jeremydunn:

...

on v.resource="ticket/"
t.id

...

}}}

Also note that the
string-concatenation operator works in SQLite and PostgreSQL; but in MySQL it works only if the db is in ANSI-mode, which it typically is not. Otherwise you need to use the concat() string function in MySQL.

comment:9 Changed 12 years ago by Steffen Hoffmann

(In [13079]) VotePlugin: Moving to new db schema, refs #4546 and #10942.

Major changes are

  • conversion of internal resource pointers from path to resource identifiers
  • schema version entry in Trac db table system
  • two time stamp columns for both, initial vote and last change/update

Introduce slightly reduced version of common schema upgrade code and unit tests covering possible install/upgrade scenarios. Time stamp columns are prerequisite for something like vote history. This might be available later on as core feature or using a wiki macro.

comment:10 Changed 12 years ago by Steffen Hoffmann

(In [13084]) VotePlugin: Add code for WikiMacros, refs #4546 and #7592.

This is WiP yet.

comment:11 Changed 12 years ago by Steffen Hoffmann

(In [13085]) VotePlugin: Use time-stamped votes, refs #4546 and #7592.

Don't delete votes anymore, what is sensible, because we may become interested in voting history later on.

Two more wiki macros are available now, that already use these time stamps.

While using current microseconds POSIX time stamps internally, care has been taken to preserve backwards-compatibility down to Trac 0.11 here.

comment:12 Changed 12 years ago by Steffen Hoffmann

(In [13091]) VotePlugin: Pipe usernames through Chrome.format_author to obfuscate email addresses, if required, refs #4546 and #7592.

Additionally I've spotted and fixed an UnicodeDecodeError due to a not unicode-aware string replacement in [[LastVoted]] wiki macro.

comment:13 Changed 12 years ago by Steffen Hoffmann

(In [13093]) VotePlugin: Re-enable voting on milestones, refs #4546, #7592 and #10942.

delete_vote obviously needed to not depend on a req object to work. That went unnoticed, because it is called only by change listeners for now.

set_vote was not ready for unversioned resources, and a subtle insanity in resource_from_path surfaced during early testing with milestones too.

Method name changes are done for clarity, that a single method call probably deals with multiple vote entries.

comment:14 Changed 12 years ago by Steffen Hoffmann

(In [13094]) VotePlugin: Make compact and top standard wiki macro arguments, refs #4546 and #7592.

List output for all three macros is limited to a maximum of 5 items, if not explicitely specified by top=<n>, where in turn 'n=0' means unlimited. The previous limit of 10 items (TopVoted only) looked like too much.

And rendering of resource links respects the compact argument too, what yields significantly reduced output for milestones and tickets.

comment:15 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

0.2.0 tagged in [14760]. 0.3.0 tagged in [14762].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.