- Timestamp:
- 27 Jan 2017, 15:53:33 (8 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/level_report.py
r14438 r14473 56 56 ) 57 57 table = [] 58 format_float = getUtility(IKofaUtils).format_float 58 59 for stud in result: 59 60 if not stud['studycourse'].has_key(str(level)): … … 71 72 end_level = getattr(stud['studycourse'].certificate, 'end_level', None) 72 73 if end_level and level >= end_level: 73 cgpa = '%.2f' % (int(100*level_obj.cumulative_params[0])/100.0) 74 cgpa = format_float(level_obj.cumulative_params[0], 2) 75 #cgpa = '%.2f' % (int(100*level_obj.cumulative_params[0])/100.0) 74 76 else: 75 cgpa = '%.3f' % (int(1000*level_obj.cumulative_params[0])/1000.0) 77 cgpa = format_float(level_obj.cumulative_params[0], 3) 78 #cgpa = '%.3f' % (int(1000*level_obj.cumulative_params[0])/1000.0) 76 79 if remark == 'FRNS': # Faculty Requirements Not Satisfied (AAUE) 77 80 cgpa = '' … … 82 85 level_obj.gpa_params[1], 83 86 passed_params[2], 84 '%.3f' % (int(1000*level_obj.gpa)/1000.0), 87 format_float(level_obj.gpa, 3), 88 #'%.3f' % (int(1000*level_obj.gpa)/1000.0), 85 89 failed_courses, 86 90 not_taken_courses, -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r14461 r14473 256 256 data = [] 257 257 style = getSampleStyleSheet() 258 format_float = getUtility(IKofaUtils).format_float 258 259 for level in levels_data: 259 260 level_obj = level['level'] … … 282 283 element[2]*cm for element in tableheader], style=CONTENT_STYLE) 283 284 data.append(table) 284 sgpa = '%s: %.2f' % (trans('Sessional GPA (rectified)', lang), level['sgpa']) 285 sgpa = format_float(level['sgpa'], 2) 286 sgpa = '%s: %s' % (trans('Sessional GPA (rectified)', lang), sgpa) 287 #sgpa = '%s: %.2f' % (trans('Sessional GPA (rectified)', lang), level['sgpa']) 285 288 data.append(Paragraph(sgpa, style["Normal"])) 286 289 return data … … 928 931 f_label = trans(_('Cumulative GPA:'), portal_language) 929 932 f_label = Paragraph(f_label, ENTRY1_STYLE) 930 f_text = formatted_text('%.3f (%s)' % ( 931 transcript_data[1], self.getClassFromCGPA( 932 transcript_data[1], student)[1])) 933 format_float = getUtility(IKofaUtils).format_float 934 cgpa = format_float(transcript_data[1], 3) 935 f_text = formatted_text('%s (%s)' % ( 936 cgpa, self.getClassFromCGPA(transcript_data[1], student)[1])) 933 937 f_text = Paragraph(f_text, ENTRY1_STYLE) 934 938 contextdata.append([f_label,f_text]) -
main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
r14040 r14473 405 405 return export_disabled_message 406 406 return None 407 408 def format_float(self, value, prec): 409 # cut floating point value 410 value = int(pow(10, prec)*value) / (1.0*pow(10, prec)) 411 return '{:{width}.{prec}f}'.format(value, width=0, prec=prec)
Note: See TracChangeset for help on using the changeset viewer.