Modify

Opened 6 years ago

Last modified 20 months ago

#4546 new enhancement

Macro to show vote lists in wiki pages

Reported by: karsten_fuhrmann Owned by: rjollos
Priority: normal Component: VotePlugin
Severity: normal Keywords:
Cc: rjollos 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 jeremydunn 2 years ago.
please add Votes to ColumnList and Filter drop-down

Download all attachments as: .zip

Change History (15)

comment:1 Changed 5 years ago by rjollos

  • Cc rjollos added; anonymous removed

comment:2 Changed 5 years ago by vincenth

Would be very welcome, and really make VotePlugin complete!

comment:3 Changed 4 years ago by rjollos

  • Owner changed from athomas to rjollos

Reassigning ticket to new maintainer.

comment:4 Changed 4 years ago by rjollos

#4362 was a duplicate.

Changed 2 years ago by jeremydunn

please add Votes to ColumnList and Filter drop-down

comment:5 follow-up: Changed 2 years ago by 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.

comment:6 in reply to: ↑ 5 ; follow-up: Changed 2 years ago by jeremydunn

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 2 years ago by rjollos

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 2 years ago by jeremydunn

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 20 months ago by hasienda

(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 20 months ago by hasienda

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

This is WiP yet.

comment:11 Changed 20 months ago by hasienda

(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 20 months ago by hasienda

(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 20 months ago by hasienda

(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 20 months ago by hasienda

(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.

Add Comment

Modify Ticket

Action
as new The owner will remain rjollos.
Author


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

 
Note: See TracTickets for help on using tickets.