Shouldn't the scale options be between 0 and 6 (and not 0 and 2 as it currently is)? This way it is possible to store a latitude and longitude like -36.123456. I changed the options in the number module from 2 to 6 '#options' => drupal_map_assoc(range(0, 6)), and it created the table fine.

CommentFileSizeAuthor
#3 number_precision.patch610 bytesjmiccolis
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patrickharris’s picture

Bumpety bump.

dopry’s picture

Status: Active » Postponed (maintainer needs more info)

?? what are you talking about and does it apply to 6.x-2.x.

jmiccolis’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Category: support » feature
Status: Postponed (maintainer needs more info) » Needs review
FileSize
610 bytes

Attached is a patch that allows for a scale up to ten.

The issue here is that cck's number field will only allow very small scale options so that storing decimal numbers that require decent precision is impossible. The most common example for this is latitude and longitude. For example the current number module will only allow you to store decimals like 1.23, and not 1.23456789. This would be nice, and only requires a small form definition change in cck.

patrickharris’s picture

No action on this? I could just store latitude and longitude as text fields I guess if I wanted to keep them in cck.

El Bandito’s picture

This would be a useful feature for me too. Any chance ?

Cheers

Dave

jmiccolis’s picture

@patrickharris & @daves - any chance either of you could review & test the patch and set the status to "patch (reviewed and tested by the community)"?

Thanks!

El Bandito’s picture

jmiccolis

Would love to test, but I'm a newbie here and haven't got a clue how to go about it. If you could point me in the right direction I'd be happy to have a go.

Cheers

Dave

jmiccolis’s picture

@Daves, Welcome!

First - download that patch, then apply -> http://drupal.org/patch/apply If you're a coder you'd probably want to look at what the patch files changes (which in this case isn't very much).

Next test it out, see if you're newly patched site has the functionality that the patch should add and that nothing else is broken.

Then post back - let us know if the patch worked, or not. If it did work and you're feeling confident change the status to 'patch (reviewed & tested by the community)' or if it's broken and you're feeling confident change the status to 'patch (code needs work)'

jmiccolis’s picture

Status: Needs review » Reviewed & tested by the community

As this patch is one line (and as I talked to Karen about it) I'm changing the status to 'rtbc' (or the modern equivalent).

Cheers!

yched’s picture

Status: Reviewed & tested by the community » Fixed

Committed #3 to 6.x-2.x. While mirroring the change to HEAD (D7), I noticed it used '6' as a max value for 'scale'. I bumped it to 10 for now.
Karen, do you know if there's a limitation ? Should we go for 6 instead of 10 ?

KarenS’s picture

We should be consistent between D6 and D7. I think the use of '6' was just an arbitrary choice. I don't know of any reason not to use '10' in both places.

yched’s picture

OK then. Right now D6 and D7 are consistent.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.