You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org> on 2011/09/14 18:59:08 UTC

[jira] [Created] (TRINIDAD-2139) Client NumberConverter with type=percent ignores maxfractiondigits when formatting

Client NumberConverter with type=percent ignores maxfractiondigits when formatting
----------------------------------------------------------------------------------

                 Key: TRINIDAD-2139
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2139
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 2.0.0
            Reporter: Yee-Wah Lee
            Priority: Minor


NumberFormat.js contains the following code:
TrNumberFormat.prototype.percentageToString = function(number)
{
  number = number * 100;
  number = this.getRounded(number);
..   number = this.numberToString(number);
}

consideration the number of fractionDigits but numberToString later will.
TrNumberFormat.prototype.getRounded = function(val)
{
  val = this.moveDecimalRight(val);
  val = Math.round(val);
  val = this.moveDecimalLeft(val);
  return val;
}

Math.round function will round to the nearest integer. With the earlier multiplication to 100, precision is preserved to at most two digits, regardless of the maxFractionDigits attribute.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TRINIDAD-2139) Client NumberConverter with type=percent ignores maxfractiondigits when formatting

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13104665#comment-13104665 ] 

Yee-Wah Lee commented on TRINIDAD-2139:
---------------------------------------

The Math.round code appears to have been there since the numberConverter was first created, it appears to be an overlooked when later fixes were made for maxFractionDigits. 

The getRounded call can be removed, since numberToString will take into account min/maxFractionDigits.

> Client NumberConverter with type=percent ignores maxfractiondigits when formatting
> ----------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-2139
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2139
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 2.0.0
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> NumberFormat.js contains the following code:
> TrNumberFormat.prototype.percentageToString = function(number)
> {
>   number = number * 100;
>   number = this.getRounded(number);
> ..   number = this.numberToString(number);
> }
> consideration the number of fractionDigits but numberToString later will.
> TrNumberFormat.prototype.getRounded = function(val)
> {
>   val = this.moveDecimalRight(val);
>   val = Math.round(val);
>   val = this.moveDecimalLeft(val);
>   return val;
> }
> Math.round function will round to the nearest integer. With the earlier multiplication to 100, precision is preserved to at most two digits, regardless of the maxFractionDigits attribute.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (TRINIDAD-2139) Client NumberConverter with type=percent ignores maxfractiondigits when formatting

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13223545#comment-13223545 ] 

Yee-Wah Lee edited comment on TRINIDAD-2139 at 4/26/12 6:34 PM:
----------------------------------------------------------------

1.2.12.7.0 fix for Trinidad-2139, allow NumberFormat to honor maxFractionDigits

Patch also works for 1.2.12.6.2 branch
                
      was (Author: yeelee):
    1.2.12.7.0 fix for Trinidad-2139, allow NumberFormat to honor maxFractionDigits
                  
> Client NumberConverter with type=percent ignores maxfractiondigits when formatting
> ----------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-2139
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2139
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 2.0.0-core
>            Reporter: Yee-Wah Lee
>            Assignee: Gabrielle Crawford
>            Priority: Minor
>             Fix For: 2.0.1-core
>
>         Attachments: branch121270_2139_maxFracDigits.diff, trunk_2139_numberPercentMaxFrac.diff
>
>
> NumberFormat.js contains the following code:
> TrNumberFormat.prototype.percentageToString = function(number)
> {
>   number = number * 100;
>   number = this.getRounded(number);
> ..   number = this.numberToString(number);
> }
> consideration the number of fractionDigits but numberToString later will.
> TrNumberFormat.prototype.getRounded = function(val)
> {
>   val = this.moveDecimalRight(val);
>   val = Math.round(val);
>   val = this.moveDecimalLeft(val);
>   return val;
> }
> Math.round function will round to the nearest integer. With the earlier multiplication to 100, precision is preserved to at most two digits, regardless of the maxFractionDigits attribute.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (TRINIDAD-2139) Client NumberConverter with type=percent ignores maxfractiondigits when formatting

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13104696#comment-13104696 ] 

Yee-Wah Lee edited comment on TRINIDAD-2139 at 9/14/11 5:51 PM:
----------------------------------------------------------------

Trinidad-2139 patch for trunk and 1.2.12.6.0 branch

      was (Author: yeelee):
    Trunk patch for Trinidad-2139
  
> Client NumberConverter with type=percent ignores maxfractiondigits when formatting
> ----------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-2139
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2139
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 2.0.0
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>         Attachments: trunk_2139_numberPercentMaxFrac.diff
>
>
> NumberFormat.js contains the following code:
> TrNumberFormat.prototype.percentageToString = function(number)
> {
>   number = number * 100;
>   number = this.getRounded(number);
> ..   number = this.numberToString(number);
> }
> consideration the number of fractionDigits but numberToString later will.
> TrNumberFormat.prototype.getRounded = function(val)
> {
>   val = this.moveDecimalRight(val);
>   val = Math.round(val);
>   val = this.moveDecimalLeft(val);
>   return val;
> }
> Math.round function will round to the nearest integer. With the earlier multiplication to 100, precision is preserved to at most two digits, regardless of the maxFractionDigits attribute.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (TRINIDAD-2139) Client NumberConverter with type=percent ignores maxfractiondigits when formatting

Posted by "Gabrielle Crawford (Resolved) (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gabrielle Crawford resolved TRINIDAD-2139.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.2-core
         Assignee: Gabrielle Crawford
    
> Client NumberConverter with type=percent ignores maxfractiondigits when formatting
> ----------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-2139
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2139
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 2.0.0-core
>            Reporter: Yee-Wah Lee
>            Assignee: Gabrielle Crawford
>            Priority: Minor
>             Fix For: 2.0.2-core
>
>         Attachments: trunk_2139_numberPercentMaxFrac.diff
>
>
> NumberFormat.js contains the following code:
> TrNumberFormat.prototype.percentageToString = function(number)
> {
>   number = number * 100;
>   number = this.getRounded(number);
> ..   number = this.numberToString(number);
> }
> consideration the number of fractionDigits but numberToString later will.
> TrNumberFormat.prototype.getRounded = function(val)
> {
>   val = this.moveDecimalRight(val);
>   val = Math.round(val);
>   val = this.moveDecimalLeft(val);
>   return val;
> }
> Math.round function will round to the nearest integer. With the earlier multiplication to 100, precision is preserved to at most two digits, regardless of the maxFractionDigits attribute.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira