← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 3903: Applied patch from Hieu. 1. Changes the data element value types to number, integer, positive int...

 

Hi Hieu,
I have looked a bit more into it, and I am not sure either of those will
work as I want. They still need a bit of tweaking. We cannot record decimal
values with this regex. :(

I will need to think about it a bit more.

As for the zeros, I do not see a strong use case to allow entry of 0.0 or
0.00000 but perhaps it is not really worth the effort to try and restrict
people from entering it.

Personally, I think to keep it simple, if people want to enter zero, they
should enter 0, and only zero, and this should be the only valid zero. I did
not utilize this function yet, but wanted some comments from others to see.

Regards,
jason



On Wed, Jun 15, 2011 at 9:30 AM, Hieu Dang Duy
<hieu.hispvietnam@xxxxxxxxx>wrote:

> Dear Jason,
>
> How do you feel if we combine isNumber and isRealNumber to be one only? But
> with the modified regex value as below:
>
> This is your patch :   var regex = /^(0(?:\.0*)?|[-]?[1-9]\d*\.?[0-9]*)$/;
>
> This is my modified : var regex = /^(0(?:\.0*)?|[-]?[1-9]\d*\.?[0-9].+)$/;
>
> One more thing, perhaps, you forget to place this isValidZeroNumber to some
> where ;) please review then let me know.
>
> Thank you.
>
>
> 2011/6/15 Jason Pickering <jason.p.pickering@xxxxxxxxx>
>
>>
>> Dear Lars and Hieu,
>>
>>
>> I would like to suggest a few more improvements to this commit. Please
>> find attached a suggested patch.
>>
>> One thing I am a little unsure of is how to handle the situation when the
>> number is a zero and should be stored.
>>
>> The problem is here..
>>
>> return isNumber( value ) && parseFloat( value ) == 0;
>>
>> if the value is 000.0000 parseFloat will return 0, but isNumber (with the
>> patch) will not allow multiple  leading zeros. Not too sure about this
>> one...
>>
>> Let me know what you think.
>>
>> Best regards,
>> Jason
>>
>>
>>
>> On Wed, Jun 15, 2011 at 4:28 AM, Hieu Dang Duy <
>> hieu.hispvietnam@xxxxxxxxx> wrote:
>>
>>> Thanks to Jason for providing in nice regex :)
>>>
>>>
>>> On Tue, Jun 14, 2011 at 11:39 PM, jason.p.pickering@xxxxxxxxx <
>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>
>>>> Thanks for this. :-)
>>>>
>>>> Sent from my HTC
>>>>
>>>>
>>>>
>>> --
>>> Good heath !
>>>
>>>
>>
>
>
> --
> Good heath !
>
>

References