Skip to content
This repository has been archived by the owner on Oct 21, 2018. It is now read-only.

Commit

Permalink
Fixed sentry 58626674
Browse files Browse the repository at this point in the history
  • Loading branch information
bufke committed Mar 18, 2015
1 parent 10ad5d1 commit 30cc231
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions ecwsp/benchmark_grade/report.py
Expand Up @@ -10,7 +10,8 @@
from ecwsp.sis.uno_report import uno_save
from ecwsp.schedule.models import MarkingPeriod, CourseSection
from ecwsp.grades.models import StudentMarkingPeriodGrade
from ecwsp.benchmark_grade.models import Category, Item, Aggregate, Demonstration
from ecwsp.benchmark_grade.models import (
Category, Item, Aggregate, Demonstration, CalculationRulePerCourseCategory)
from ecwsp.benchmark_grade.utility import benchmark_find_calculation_rule, gradebook_get_average
from ecwsp.benchmark_grade.views import gradebook

Expand All @@ -19,10 +20,10 @@

if 'TRAVIS' not in os.environ:
"""this import is killing us on TravisCI, so I'm removing it. There
may be a better way to do this, but we honestly don't need anything
may be a better way to do this, but we honestly don't need anything
from this file during our test runs."""
import uno

import re
from decimal import Decimal, ROUND_HALF_UP
from datetime import date
Expand Down Expand Up @@ -136,8 +137,8 @@ def get_benchmark_report_card_data(report_context, appy_context, students):
if value:
student.count_percentage_by_category_name[category_name] = (Decimal(student.count_passing_by_category_name[category_name]) / value * 100).quantize(Decimal('0', ROUND_HALF_UP))

# make categories available
# make categories available

try:
student.session_gpa = student.studentmarkingperiodgrade_set.get(
marking_period=marking_period).grade
Expand Down Expand Up @@ -175,7 +176,7 @@ def get_benchmark_report_card_data(report_context, appy_context, students):

@staff_member_required
def student_incomplete_course_sections(request):
if 'inverse' in request.GET:
if 'inverse' in request.GET:
inverse = True
else:
inverse = False
Expand Down Expand Up @@ -224,14 +225,14 @@ def student_incomplete_course_sections(request):
course_section_detail = course_section_detail[1] # discard the course section id
narrative.append(u'{} ({})'.format(course_section_detail['name'], u', '.join(course_section_detail['marking_periods'])))
data.append([student.last_name, student.first_name, student.year, work_day, u'; '.join(narrative)])

report = XlReport()
report.add_sheet(data, header_row=titles, title="Sheet1", auto_width=True)
return report.as_download()
return report.as_download()

@staff_member_required
def student_zero_dp_standards(request):
if 'inverse' in request.GET:
if 'inverse' in request.GET:
inverse = True
else:
inverse = False
Expand Down Expand Up @@ -315,7 +316,7 @@ def gradebook_export(request, course_section_id):
if type(gradebook_data) is not dict:
# something we can't use, like a 404 or a redirect
return gradebook_data

from ecwsp.sis.xl_report import XlReport
report = XlReport(file_name=slugify(gradebook_data['course_section'].name))
rows = []
Expand Down Expand Up @@ -377,7 +378,7 @@ def gradebook_export(request, course_section_id):
rows[row_counter].append(mark.get_grade())
rows[row_counter].append(student.average)
row_counter += 1

report.add_sheet(rows, title=gradebook_data['course_section'].name)
sheet = report.workbook.get_active_sheet()
if report.old_openpyxl:
Expand All @@ -390,4 +391,4 @@ def gradebook_export(request, course_section_id):
cell.style = cell.style.copy(font=cell.style.font.copy(bold=True))
cell = sheet.cell(row=course_section_average_row, column=course_section_average_column)
cell.style = cell.style.copy(font=cell.style.font.copy(bold=True))
return report.as_download()
return report.as_download()

0 comments on commit 30cc231

Please sign in to comment.