Edgewall Software

Ticket #4019 (new defect)

Opened 23 months ago

Last modified 2 months ago

[PATCH] - Ticket Api does not contain 'time' and 'changetime' fields

Reported by: ilias@… Owned by: jonas
Priority: normal Milestone: 0.12
Component: ticket system Version: devel
Severity: normal Keywords: created lastmodified
Cc: mjs@…, goncha@…

Description (last modified by cboos) (diff)

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

Attachments

TicketApiAddMissingFields.diff (0.6 kB) - added by ilias@… 23 months ago.
TicketApiAddMissingFieldsOptional.diff (1.3 kB) - added by ilias@… 23 months ago.
patch with added option "all_fields"
TicketQueryMissingFieldsByMgood.diff (1.8 kB) - added by ilias@… 23 months ago.
Patch provided by mgood

Change History

Changed 23 months ago by ilias@…

follow-up: ↓ 2   Changed 23 months ago by 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?

in reply to: ↑ 1   Changed 23 months ago by ilias@…

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

  Changed 23 months ago by ilias@…

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?

Changed 23 months ago by ilias@…

patch with added option "all_fields"

follow-ups: ↓ 5 ↓ 7   Changed 23 months ago by 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.

in reply to: ↑ 4 ; follow-up: ↓ 6   Changed 23 months ago by ThurnerRupert <rupert.thurner@…>

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 ; follow-up: ↓ 9   Changed 23 months ago by ilias@…

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   Changed 23 months ago by ilias@…

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

Changed 23 months ago by ilias@…

Patch provided by mgood

  Changed 23 months ago by ilias@…

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

in reply to: ↑ 6   Changed 22 months ago by ilias@…

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

  Changed 22 months ago by mjs@…

  • cc mjs@… added

  Changed 18 months ago by cboos

  • keywords created lastmodified added
  • description modified (diff)
  • milestone set to 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.

  Changed 2 months ago by cboos

  • cc goncha@… added
  • milestone changed from 0.11.2 to 0.12

The latest patch related to #2288 also addresses this.

Add/Change #4019 ([PATCH] - Ticket Api does not contain 'time' and 'changetime' fields)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change. Next status will be 'new'
The owner will change to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.