@@ 590-617 (lines=28) @@ | ||
587 | result['reporting_period']['total_increment_rate'] = Decimal(0.0) |
|
588 | result['reporting_period']['total_unit'] = config.currency_unit |
|
589 | ||
590 | if energy_category_set is not None and len(energy_category_set) > 0: |
|
591 | for energy_category_id in energy_category_set: |
|
592 | result['reporting_period']['names'].append(energy_category_dict[energy_category_id]['name']) |
|
593 | result['reporting_period']['energy_category_ids'].append(energy_category_id) |
|
594 | result['reporting_period']['units'].append(config.currency_unit) |
|
595 | result['reporting_period']['timestamps'].append(reporting[energy_category_id]['timestamps']) |
|
596 | result['reporting_period']['values'].append(reporting[energy_category_id]['values']) |
|
597 | result['reporting_period']['subtotals'].append(reporting[energy_category_id]['subtotal']) |
|
598 | result['reporting_period']['subtotals_per_unit_area'].append( |
|
599 | reporting[energy_category_id]['subtotal'] / space['area'] if space['area'] > 0.0 else None) |
|
600 | result['reporting_period']['subtotals_per_capita'].append( |
|
601 | reporting[energy_category_id]['subtotal'] / space['number_of_occupants'] |
|
602 | if space['number_of_occupants'] > 0.0 else None) |
|
603 | result['reporting_period']['increment_rates'].append( |
|
604 | (reporting[energy_category_id]['subtotal'] - base[energy_category_id]['subtotal']) / |
|
605 | base[energy_category_id]['subtotal'] |
|
606 | if base[energy_category_id]['subtotal'] > 0.0 else None) |
|
607 | result['reporting_period']['total'] += reporting[energy_category_id]['subtotal'] |
|
608 | ||
609 | rate = list() |
|
610 | for index, value in enumerate(reporting[energy_category_id]['values']): |
|
611 | if index < len(base[energy_category_id]['values']) \ |
|
612 | and base[energy_category_id]['values'][index] != 0 and value != 0: |
|
613 | rate.append((value - base[energy_category_id]['values'][index]) |
|
614 | / base[energy_category_id]['values'][index]) |
|
615 | else: |
|
616 | rate.append(None) |
|
617 | result['reporting_period']['rates'].append(rate) |
|
618 | ||
619 | result['reporting_period']['total_per_unit_area'] = \ |
|
620 | result['reporting_period']['total'] / space['area'] if space['area'] > 0.0 else None |
@@ 585-611 (lines=27) @@ | ||
582 | result['reporting_period']['subtotals_per_capita'] = list() |
|
583 | result['reporting_period']['increment_rates'] = list() |
|
584 | ||
585 | if energy_category_set is not None and len(energy_category_set) > 0: |
|
586 | for energy_category_id in energy_category_set: |
|
587 | result['reporting_period']['names'].append(energy_category_dict[energy_category_id]['name']) |
|
588 | result['reporting_period']['energy_category_ids'].append(energy_category_id) |
|
589 | result['reporting_period']['units'].append(energy_category_dict[energy_category_id]['unit_of_measure']) |
|
590 | result['reporting_period']['timestamps'].append(reporting[energy_category_id]['timestamps']) |
|
591 | result['reporting_period']['values'].append(reporting[energy_category_id]['values']) |
|
592 | result['reporting_period']['subtotals'].append(reporting[energy_category_id]['subtotal']) |
|
593 | result['reporting_period']['subtotals_per_unit_area'].append( |
|
594 | reporting[energy_category_id]['subtotal'] / space['area'] if space['area'] > 0.0 else None) |
|
595 | result['reporting_period']['subtotals_per_capita'].append( |
|
596 | reporting[energy_category_id]['subtotal'] / space['number_of_occupants'] |
|
597 | if space['number_of_occupants'] > 0.0 else None) |
|
598 | result['reporting_period']['increment_rates'].append( |
|
599 | (reporting[energy_category_id]['subtotal'] - base[energy_category_id]['subtotal']) / |
|
600 | base[energy_category_id]['subtotal'] |
|
601 | if base[energy_category_id]['subtotal'] > 0.0 else None) |
|
602 | ||
603 | rate = list() |
|
604 | for index, value in enumerate(reporting[energy_category_id]['values']): |
|
605 | if index < len(base[energy_category_id]['values']) \ |
|
606 | and base[energy_category_id]['values'][index] != 0 and value != 0: |
|
607 | rate.append((value - base[energy_category_id]['values'][index]) |
|
608 | / base[energy_category_id]['values'][index]) |
|
609 | else: |
|
610 | rate.append(None) |
|
611 | result['reporting_period']['rates'].append(rate) |
|
612 | ||
613 | result['parameters'] = { |
|
614 | "names": parameters_data['names'], |