| @@ 733-791 (lines=59) @@ | ||
| 730 | ||
| 731 | while current_datetime_utc <= end_datetime_utc: |
|
| 732 | # calculate the next datetime in utc |
|
| 733 | if current_datetime_utc.month == 1: |
|
| 734 | temp_day = 28 |
|
| 735 | ny = current_datetime_utc.year |
|
| 736 | if (ny % 100 != 0 and ny % 4 == 0) or (ny % 100 == 0 and ny % 400 == 0): |
|
| 737 | temp_day = 29 |
|
| 738 | ||
| 739 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 740 | month=current_datetime_utc.month + 1, |
|
| 741 | day=temp_day, |
|
| 742 | hour=current_datetime_utc.hour, |
|
| 743 | minute=current_datetime_utc.minute, |
|
| 744 | second=0, |
|
| 745 | microsecond=0, |
|
| 746 | tzinfo=None) |
|
| 747 | elif current_datetime_utc.month == 2: |
|
| 748 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 749 | month=current_datetime_utc.month + 1, |
|
| 750 | day=31, |
|
| 751 | hour=current_datetime_utc.hour, |
|
| 752 | minute=current_datetime_utc.minute, |
|
| 753 | second=0, |
|
| 754 | microsecond=0, |
|
| 755 | tzinfo=None) |
|
| 756 | elif current_datetime_utc.month in [3, 5, 8, 10]: |
|
| 757 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 758 | month=current_datetime_utc.month + 1, |
|
| 759 | day=30, |
|
| 760 | hour=current_datetime_utc.hour, |
|
| 761 | minute=current_datetime_utc.minute, |
|
| 762 | second=0, |
|
| 763 | microsecond=0, |
|
| 764 | tzinfo=None) |
|
| 765 | elif current_datetime_utc.month == 7: |
|
| 766 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 767 | month=current_datetime_utc.month + 1, |
|
| 768 | day=31, |
|
| 769 | hour=current_datetime_utc.hour, |
|
| 770 | minute=current_datetime_utc.minute, |
|
| 771 | second=0, |
|
| 772 | microsecond=0, |
|
| 773 | tzinfo=None) |
|
| 774 | elif current_datetime_utc.month in [4, 6, 9, 11]: |
|
| 775 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 776 | month=current_datetime_utc.month + 1, |
|
| 777 | day=31, |
|
| 778 | hour=current_datetime_utc.hour, |
|
| 779 | minute=current_datetime_utc.minute, |
|
| 780 | second=0, |
|
| 781 | microsecond=0, |
|
| 782 | tzinfo=None) |
|
| 783 | elif current_datetime_utc.month == 12: |
|
| 784 | next_datetime_utc = datetime(year=current_datetime_utc.year + 1, |
|
| 785 | month=1, |
|
| 786 | day=31, |
|
| 787 | hour=current_datetime_utc.hour, |
|
| 788 | minute=current_datetime_utc.minute, |
|
| 789 | second=0, |
|
| 790 | microsecond=0, |
|
| 791 | tzinfo=None) |
|
| 792 | ||
| 793 | sub_total = Decimal(0.0) |
|
| 794 | for row in rows_hourly: |
|
| @@ 475-533 (lines=59) @@ | ||
| 472 | ||
| 473 | while current_datetime_utc <= end_datetime_utc: |
|
| 474 | # calculate the next datetime in utc |
|
| 475 | if current_datetime_utc.month == 1: |
|
| 476 | temp_day = 28 |
|
| 477 | ny = current_datetime_utc.year |
|
| 478 | if (ny % 100 != 0 and ny % 4 == 0) or (ny % 100 == 0 and ny % 400 == 0): |
|
| 479 | temp_day = 29 |
|
| 480 | ||
| 481 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 482 | month=current_datetime_utc.month + 1, |
|
| 483 | day=temp_day, |
|
| 484 | hour=current_datetime_utc.hour, |
|
| 485 | minute=current_datetime_utc.minute, |
|
| 486 | second=0, |
|
| 487 | microsecond=0, |
|
| 488 | tzinfo=None) |
|
| 489 | elif current_datetime_utc.month == 2: |
|
| 490 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 491 | month=current_datetime_utc.month + 1, |
|
| 492 | day=31, |
|
| 493 | hour=current_datetime_utc.hour, |
|
| 494 | minute=current_datetime_utc.minute, |
|
| 495 | second=0, |
|
| 496 | microsecond=0, |
|
| 497 | tzinfo=None) |
|
| 498 | elif current_datetime_utc.month in [3, 5, 8, 10]: |
|
| 499 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 500 | month=current_datetime_utc.month + 1, |
|
| 501 | day=30, |
|
| 502 | hour=current_datetime_utc.hour, |
|
| 503 | minute=current_datetime_utc.minute, |
|
| 504 | second=0, |
|
| 505 | microsecond=0, |
|
| 506 | tzinfo=None) |
|
| 507 | elif current_datetime_utc.month == 7: |
|
| 508 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 509 | month=current_datetime_utc.month + 1, |
|
| 510 | day=31, |
|
| 511 | hour=current_datetime_utc.hour, |
|
| 512 | minute=current_datetime_utc.minute, |
|
| 513 | second=0, |
|
| 514 | microsecond=0, |
|
| 515 | tzinfo=None) |
|
| 516 | elif current_datetime_utc.month in [4, 6, 9, 11]: |
|
| 517 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 518 | month=current_datetime_utc.month + 1, |
|
| 519 | day=31, |
|
| 520 | hour=current_datetime_utc.hour, |
|
| 521 | minute=current_datetime_utc.minute, |
|
| 522 | second=0, |
|
| 523 | microsecond=0, |
|
| 524 | tzinfo=None) |
|
| 525 | elif current_datetime_utc.month == 12: |
|
| 526 | next_datetime_utc = datetime(year=current_datetime_utc.year + 1, |
|
| 527 | month=1, |
|
| 528 | day=31, |
|
| 529 | hour=current_datetime_utc.hour, |
|
| 530 | minute=current_datetime_utc.minute, |
|
| 531 | second=0, |
|
| 532 | microsecond=0, |
|
| 533 | tzinfo=None) |
|
| 534 | ||
| 535 | sub_total = Decimal(0.0) |
|
| 536 | sub_maximum = None |
|
| @@ 65-123 (lines=59) @@ | ||
| 62 | ||
| 63 | while current_datetime_utc <= end_datetime_utc: |
|
| 64 | # calculate the next datetime in utc |
|
| 65 | if current_datetime_utc.month == 1: |
|
| 66 | temp_day = 28 |
|
| 67 | ny = current_datetime_utc.year |
|
| 68 | if (ny % 100 != 0 and ny % 4 == 0) or (ny % 100 == 0 and ny % 400 == 0): |
|
| 69 | temp_day = 29 |
|
| 70 | ||
| 71 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 72 | month=current_datetime_utc.month + 1, |
|
| 73 | day=temp_day, |
|
| 74 | hour=current_datetime_utc.hour, |
|
| 75 | minute=current_datetime_utc.minute, |
|
| 76 | second=0, |
|
| 77 | microsecond=0, |
|
| 78 | tzinfo=None) |
|
| 79 | elif current_datetime_utc.month == 2: |
|
| 80 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 81 | month=current_datetime_utc.month + 1, |
|
| 82 | day=31, |
|
| 83 | hour=current_datetime_utc.hour, |
|
| 84 | minute=current_datetime_utc.minute, |
|
| 85 | second=0, |
|
| 86 | microsecond=0, |
|
| 87 | tzinfo=None) |
|
| 88 | elif current_datetime_utc.month in [3, 5, 8, 10]: |
|
| 89 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 90 | month=current_datetime_utc.month + 1, |
|
| 91 | day=30, |
|
| 92 | hour=current_datetime_utc.hour, |
|
| 93 | minute=current_datetime_utc.minute, |
|
| 94 | second=0, |
|
| 95 | microsecond=0, |
|
| 96 | tzinfo=None) |
|
| 97 | elif current_datetime_utc.month == 7: |
|
| 98 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 99 | month=current_datetime_utc.month + 1, |
|
| 100 | day=31, |
|
| 101 | hour=current_datetime_utc.hour, |
|
| 102 | minute=current_datetime_utc.minute, |
|
| 103 | second=0, |
|
| 104 | microsecond=0, |
|
| 105 | tzinfo=None) |
|
| 106 | elif current_datetime_utc.month in [4, 6, 9, 11]: |
|
| 107 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 108 | month=current_datetime_utc.month + 1, |
|
| 109 | day=31, |
|
| 110 | hour=current_datetime_utc.hour, |
|
| 111 | minute=current_datetime_utc.minute, |
|
| 112 | second=0, |
|
| 113 | microsecond=0, |
|
| 114 | tzinfo=None) |
|
| 115 | elif current_datetime_utc.month == 12: |
|
| 116 | next_datetime_utc = datetime(year=current_datetime_utc.year + 1, |
|
| 117 | month=1, |
|
| 118 | day=31, |
|
| 119 | hour=current_datetime_utc.hour, |
|
| 120 | minute=current_datetime_utc.minute, |
|
| 121 | second=0, |
|
| 122 | microsecond=0, |
|
| 123 | tzinfo=None) |
|
| 124 | ||
| 125 | subtotal = Decimal(0.0) |
|
| 126 | for row in rows_hourly: |
|