Edgewall Software
Modify

Opened 14 years ago

Last modified 4 years ago

#10040 new enhancement

Support for integer/float custom fields

Reported by: pipern Owned by:
Priority: normal Milestone: next-dev-1.7.x
Component: ticket system Version:
Severity: normal Keywords: patch
Cc: osimons, leho@…, Ryan J Ollos Branch:
Release Notes:

Adds integer and float as custom field type and query language constraints < and >.

API Changes:

Adds a 'datatype' key to the TicketSystem.fields list, which can contain string:

  • string
  • float
  • integer
Internal Changes:

Description

See http://article.gmane.org/gmane.comp.version-control.subversion.trac.devel/6561 for some discussion.

We'd like to be able to mark some custom fields as "contains integer" or "contains floating number". This would then let us sort numerically, validate user input, add an aggregation/summing feature, and so on.

We're not thinking of changing the storage type, nor, currently, the Python type that exists in the ticket.fields list. Instead, we just validate the user input and then later we can also attempt to convert the field value to the numeric type if we want to do sorting or summing.

This can fix #3080, but walks in the wrong way for FieldRefactoring.

Attachments (1)

numeric-fields-r10583-ticket-10040.patch (41.9 KB ) - added by pipern 14 years ago.
Add validation/use of numeric (custom) fields

Download all attachments as: .zip

Change History (16)

comment:1 by pipern, 14 years ago

Release Notes: modified (diff)

by pipern, 14 years ago

Add validation/use of numeric (custom) fields

comment:2 by Remy Blank, 14 years ago

Milestone: 0.14

Looks very interesting, thanks! I'm not sure we will manage to get this into 0.13, as we already have the time fields to be integrated there. So I'm scheduling for 0.14 for now.

comment:3 by Christian Boos, 14 years ago

Looks fine, but as you don't seem to actually use or test for datatype == 'string', I wonder if we couldn't just leave that out of the picture and assume that if datatype is not set or empty, it's a textual field.

in reply to:  3 comment:4 by pipern, 14 years ago

Replying to cboos:

Looks fine, but as you don't seem to actually use or test for datatype == 'string', I wonder if we couldn't just leave that out of the picture and assume that if datatype is not set or empty, it's a textual field.

It's true that 'string' has nothing special happening to it. It's there mostly as documentation I suppose.

comment:5 by osimons, 14 years ago

Cc: osimons added

comment:6 by lkraav <leho@…>, 10 years ago

Cc: leho@… added

comment:7 by Ryan J Ollos, 10 years ago

Cc: Ryan J Ollos added

comment:8 by Ryan J Ollos, 10 years ago

#11132 closed as a duplicate.

comment:9 by Ryan J Ollos, 10 years ago

Keywords: bitesized added

comment:10 by Ryan J Ollos, 9 years ago

Milestone: next-dev-1.1.xnext-dev-1.3.x

comment:11 by Jun Omae, 8 years ago

Keywords: bitesized removed
Release Notes: modified (diff)

Non-bitsized.

comment:12 by Jun Omae, 8 years ago

The proposed patch would lead errors with non-numeric string on PostgreSQL.

template1=# SELECT CAST('42' AS INTEGER);
 int4
------
   42
(1 row)

template1=# SELECT CAST('abc' AS INTEGER);
ERROR:  invalid input syntax for integer: "abc"
LINE 1: SELECT CAST('abc' AS INTEGER);
                    ^
template1=# SELECT CAST('42abc' AS INTEGER);
ERROR:  invalid input syntax for integer: "42abc"
LINE 1: SELECT CAST('42abc' AS INTEGER);
                    ^

comment:13 by Ryan J Ollos, 8 years ago

#8812 closed as a duplicate.

comment:14 by Ryan J Ollos, 5 years ago

Milestone: next-dev-1.3.xnext-dev-1.5.x

Milestone renamed

comment:15 by Ryan J Ollos, 4 years ago

Milestone: next-dev-1.5.xnext-dev-1.7.x

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.