mercredi 27 janvier 2016

in rails erb file i want to display an output as a decimal only at one place where actually it is showing as a float value

<div class='summary' align="justify" style='vertical-align: top;'>
        <div>
            {{:stats.tot_fte}} Employees Assigned 
            &emsp; {{:stats.tot_fte_effort}} Total Effort
        </div>
        <div>
            {{:stats.tot_users}} Users Assigned 
            &emsp;&emsp;&emsp; {{:stats.tot_user_effort}} Total Effort
        </div> 
    </div>

this is the code which i wrote to display total effort as output where i calculate total effort at some other place,where it should always be float value as i use it for other calculations.But while displaying this here i want it to be a decimal value with two numbers after the decimal.please help me in completing this as i am a beginner. The output is as follows,

340 Employees Assigned   340.89666666666665 Total Effort

453 Users Assigned     452.6066666666666 Total Effort

i want the total effort display as a decimal value only here.

Aucun commentaire:

Enregistrer un commentaire