so if `perc >=90%, it is grade `A`? The code should reflect the same then. Right now, it is `A`, if `perc >= 100`, which is not a valid value for `perc`.
Am guessing the same is applicable for the `average` check too.

________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On 18-Nov-17 1:37 PM, mostwanted wrote:

 I am getting wrong results with my grading system, i think this is more of a syntax problem, i just don't know where I'm mixing up things. My system is supposed to give students grades depending on what percentages they got but the grades do not correspond well with the percentages. I'm getting wrong grades for percentages, e.g 90% is supposed to give me grade 'A' but it is giving me grade 'B', they are all mixed up!!! Can someone assist please?! Thanks.

Here is my code:
|
{{extend 'layout.html'}}
..............
..............
..............
{{
         total=0
forreport inform:
        perc=(float(report.marks)/float(report.total))*float(100)
ifperc>=100:
            grade='A'
elifperc>=79:
            grade='B'
elifperc>=69:
            grade='C'
elifperc>=59:
            grade='D'
elifperc>=39:
            grade='E'
elifperc>=19:
            grade='U'
}}

{{pass}}
{{
        total+=perc
        average=int(average/totalNum)
ifaverage>=100:
            avGrade='A'
elif|average|>=79:
            avGrade='B'
elif|average|>=69:
            avGrade='C'
elif|average|>=59:
            avGrade='D'
elif|average|>=39:
            avGrade='E'
elif|average|>=19:
            avGrade='E'
}}
{{pass}}
<tr>
<td>{{=report.term.term}}</td>
<td>{{=report.subject.subject_name}}</td>
<td>{{=report.marks}}</td>
<td>{{=report.total}}</td>
<td>
{{=perc}}(%)
</td>
            <td>{{=grade}}</td>
</td>
        <td>{{=report.comments}}</td>
</tr>


       {{pass}}
{{pass}}
    </table>
</div>
<div class="grades" style="margin-left: 5px;">
    <table>
        <tr>
            <th>AVERAGE</th>
<th>TOTAL/GRADE</th>
            <th>CLASS/PS</th>
            <th>SCHOOL/PS</th>
        </tr>
<tr>
<td>{{=|average|}}(%)</td>
<td>{{=avGrade}}</td>
<td>3</td>
            <td>21</td>
</tr>
    </table>
|


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com <mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to