Edgewall Software

Ticket #4019 (closed defect: fixed)

Opened 2 years ago

Last modified 5 weeks ago

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

Reported by: ilias@… Owned by: rblank
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@… 2 years ago.
TicketApiAddMissingFieldsOptional.diff (1.3 KB) - added by ilias@… 2 years ago.
patch with added option "all_fields"
TicketQueryMissingFieldsByMgood.diff (1.8 KB) - added by ilias@… 2 years ago.
Patch provided by mgood

Change History

Changed 2 years ago by ilias@…

follow-up: ↓ 2   Changed 2 years 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 2 years 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 2 years 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 2 years ago by ilias@…

patch with added option "all_fields"

follow-ups: ↓ 5 ↓ 7   Changed 2 years 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 2 years 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 2 years 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 2 years 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 2 years ago by ilias@…

Patch provided by mgood

  Changed 2 years ago by ilias@…

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

in reply to: ↑ 6   Changed 2 years 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 2 years ago by mjs@…

  • cc mjs@… added

  Changed 21 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 5 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.

follow-up: ↓ 14   Changed 5 weeks ago by cboos

  • owner changed from jonas to rblank

Fixed I believe?

in reply to: ↑ 13   Changed 5 weeks ago by rblank

  • status changed from new to closed
  • resolution set to fixed

Replying to cboos:

Fixed I believe?

Yes, fixed in [7588], tracked in #2288.

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

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from rblank. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.