Edgewall Software

Opened 18 years ago

Last modified 16 years ago

#4019 closed defect

[PATCH] - Ticket Api does not contain 'time' and 'changetime' fields — at Version 11

Reported by: ilias@… Owned by: Jonas Borgström
Priority: normal Milestone: 0.12
Component: ticket system Version: devel
Severity: normal Keywords: created lastmodified
Cc: mjs@…, goncha@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

source:trunk/trac/ticket/api.py@3935#L88

The attached patch introduces the fields 'time' and 'changetime' to the ticket api.

This enables e.g. sorting on those fields within queries (ticket-query-macro).

(sidenote: "'type': 'text'" can be possibly changed later e.g. to "datetime", in order to allow formatting of the values within the UI)

context: http://dev.lazaridis.com/base/wiki/PlanTicketQueryMacro

Change History (14)

by ilias@…, 18 years ago

comment:1 by Christopher Lenz, 18 years ago

I've not tried the patch, but doesn't this mean those fields are going to be displayed among the other form fields on the newticket/ticket pages?

in reply to:  1 comment:2 by ilias@…, 18 years ago

Replying to cmlenz:

I've not tried the patch, but doesn't this mean those fields are going to be displayed among the other form fields on the newticket/ticket pages?

yes, you are right.

I guess I've missinterpreted the meaning of "Ticket Api".

comment:3 by ilias@…, 18 years ago

The Query uses "TicketSystem(self.env).get_ticket_fields()" to get the ticket fields:

source:trunk/trac/ticket/query.py#rev=3935#L51

'time' and 'changetime' are missing, thus ordering does not work.

possibly changing get_ticket_fields() to

get_ticket_fields(all=false)

This would keep existent behaviour, but would return those missing fields on request (setting all=true).

or alternatively

get_ticket_fields(for_gui=True)

would this be ok?

by ilias@…, 18 years ago

patch with added option "all_fields"

comment:4 by Matthew Good, 18 years ago

I'm -1 on this. The get_ticket_fields function is intended for fields that should be user-editable. The Ticket model class has attributes time_created and time_changed for accessing that information. I don't have problem with the query supporting filtering or sorting by the creation or changed date/time, but I don't think it requires adding those to get_ticket_fields.

in reply to:  4 ; comment:5 by ThurnerRupert <rupert.thurner@…>, 18 years ago

Replying to mgood:

I'm -1 on this. The get_ticket_fields function is intended for fields that should be user-editable. The Ticket model class has attributes time_created and time_changed for accessing that information. I don't have problem with the query supporting filtering or sorting by the creation or changed date/time, but I don't think it requires adding those to get_ticket_fields.

what would you suggest to get all tickest closed in the last week/month? or the tickets closed by user x in the last month?

in reply to:  5 ; comment:6 by ilias@…, 18 years ago

Replying to ThurnerRupert <rupert.thurner@gmail.com>:

what would you suggest to get all tickest closed in the last week/month? or the tickets closed by user x in the last month?

An answer to this would go out of the scope of this ticket, which is just the inclusion of the 'time' and 'changetime' fields into the 'get_ticket_fields' function.

see further comments within:

http://groups.google.com/group/trac-dev/msg/7c9edb15d47434bb

a summary: include the fields into "get_ticket_fields" and ensure that systems using this function ignore the fields that they cannot handle.

I'll try to post a followup patch which covers the "add-filter" issue.

in reply to:  4 comment:7 by ilias@…, 18 years ago

Replying to mgood:

I'm -1 on this. The get_ticket_fields function is intended for fields that should …

due to temporary problems with trac-anti-spam, comment here:

http://groups.google.com/group/trac-dev/msg/78fc1a819c87ea9f

by ilias@…, 18 years ago

Patch provided by mgood

comment:8 by ilias@…, 18 years ago

please ignore the last attached file (TicketQueryMissingFieldsByMgood.diff), as the patch does not work.

in reply to:  6 comment:9 by ilias@…, 18 years ago

Replying to ilias@lazaridis.com:

I'll try to post a followup patch which covers the "add-filter" issue.

http://dev.lazaridis.com/base/changeset/115

comment:10 by mjs@…, 17 years ago

Cc: mjs@… added

comment:11 by Christian Boos, 17 years ago

Description: modified (diff)
Keywords: created lastmodified added
Milestone: 0.11

The get_ticket_fields API should be clarified, and more field types should be handled (dates among others).

Tentatively set to 0.11, if this fits with the current WorkFlow changes.

See also #2288 and #4966.

Note: See TracTickets for help on using tickets.