| @@ 963-1021 (lines=59) @@ | ||
| 960 | ||
| 961 | while current_datetime_utc <= end_datetime_utc: |
|
| 962 | # calculate the next datetime in utc |
|
| 963 | if current_datetime_utc.month == 1: |
|
| 964 | temp_day = 28 |
|
| 965 | ny = current_datetime_utc.year |
|
| 966 | if (ny % 100 != 0 and ny % 4 == 0) or (ny % 100 == 0 and ny % 400 == 0): |
|
| 967 | temp_day = 29 |
|
| 968 | ||
| 969 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 970 | month=current_datetime_utc.month + 1, |
|
| 971 | day=temp_day, |
|
| 972 | hour=current_datetime_utc.hour, |
|
| 973 | minute=current_datetime_utc.minute, |
|
| 974 | second=0, |
|
| 975 | microsecond=0, |
|
| 976 | tzinfo=None) |
|
| 977 | elif current_datetime_utc.month == 2: |
|
| 978 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 979 | month=current_datetime_utc.month + 1, |
|
| 980 | day=31, |
|
| 981 | hour=current_datetime_utc.hour, |
|
| 982 | minute=current_datetime_utc.minute, |
|
| 983 | second=0, |
|
| 984 | microsecond=0, |
|
| 985 | tzinfo=None) |
|
| 986 | elif current_datetime_utc.month in [3, 5, 8, 10]: |
|
| 987 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 988 | month=current_datetime_utc.month + 1, |
|
| 989 | day=30, |
|
| 990 | hour=current_datetime_utc.hour, |
|
| 991 | minute=current_datetime_utc.minute, |
|
| 992 | second=0, |
|
| 993 | microsecond=0, |
|
| 994 | tzinfo=None) |
|
| 995 | elif current_datetime_utc.month == 7: |
|
| 996 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 997 | month=current_datetime_utc.month + 1, |
|
| 998 | day=31, |
|
| 999 | hour=current_datetime_utc.hour, |
|
| 1000 | minute=current_datetime_utc.minute, |
|
| 1001 | second=0, |
|
| 1002 | microsecond=0, |
|
| 1003 | tzinfo=None) |
|
| 1004 | elif current_datetime_utc.month in [4, 6, 9, 11]: |
|
| 1005 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 1006 | month=current_datetime_utc.month + 1, |
|
| 1007 | day=31, |
|
| 1008 | hour=current_datetime_utc.hour, |
|
| 1009 | minute=current_datetime_utc.minute, |
|
| 1010 | second=0, |
|
| 1011 | microsecond=0, |
|
| 1012 | tzinfo=None) |
|
| 1013 | elif current_datetime_utc.month == 12: |
|
| 1014 | next_datetime_utc = datetime(year=current_datetime_utc.year + 1, |
|
| 1015 | month=1, |
|
| 1016 | day=31, |
|
| 1017 | hour=current_datetime_utc.hour, |
|
| 1018 | minute=current_datetime_utc.minute, |
|
| 1019 | second=0, |
|
| 1020 | microsecond=0, |
|
| 1021 | tzinfo=None) |
|
| 1022 | ||
| 1023 | sub_total = Decimal(0.0) |
|
| 1024 | for row in rows_hourly: |
|
| @@ 650-708 (lines=59) @@ | ||
| 647 | ||
| 648 | while current_datetime_utc <= end_datetime_utc: |
|
| 649 | # calculate the next datetime in utc |
|
| 650 | if current_datetime_utc.month == 1: |
|
| 651 | temp_day = 28 |
|
| 652 | ny = current_datetime_utc.year |
|
| 653 | if (ny % 100 != 0 and ny % 4 == 0) or (ny % 100 == 0 and ny % 400 == 0): |
|
| 654 | temp_day = 29 |
|
| 655 | ||
| 656 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 657 | month=current_datetime_utc.month + 1, |
|
| 658 | day=temp_day, |
|
| 659 | hour=current_datetime_utc.hour, |
|
| 660 | minute=current_datetime_utc.minute, |
|
| 661 | second=0, |
|
| 662 | microsecond=0, |
|
| 663 | tzinfo=None) |
|
| 664 | elif current_datetime_utc.month == 2: |
|
| 665 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 666 | month=current_datetime_utc.month + 1, |
|
| 667 | day=31, |
|
| 668 | hour=current_datetime_utc.hour, |
|
| 669 | minute=current_datetime_utc.minute, |
|
| 670 | second=0, |
|
| 671 | microsecond=0, |
|
| 672 | tzinfo=None) |
|
| 673 | elif current_datetime_utc.month in [3, 5, 8, 10]: |
|
| 674 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 675 | month=current_datetime_utc.month + 1, |
|
| 676 | day=30, |
|
| 677 | hour=current_datetime_utc.hour, |
|
| 678 | minute=current_datetime_utc.minute, |
|
| 679 | second=0, |
|
| 680 | microsecond=0, |
|
| 681 | tzinfo=None) |
|
| 682 | elif current_datetime_utc.month == 7: |
|
| 683 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 684 | month=current_datetime_utc.month + 1, |
|
| 685 | day=31, |
|
| 686 | hour=current_datetime_utc.hour, |
|
| 687 | minute=current_datetime_utc.minute, |
|
| 688 | second=0, |
|
| 689 | microsecond=0, |
|
| 690 | tzinfo=None) |
|
| 691 | elif current_datetime_utc.month in [4, 6, 9, 11]: |
|
| 692 | next_datetime_utc = datetime(year=current_datetime_utc.year, |
|
| 693 | month=current_datetime_utc.month + 1, |
|
| 694 | day=31, |
|
| 695 | hour=current_datetime_utc.hour, |
|
| 696 | minute=current_datetime_utc.minute, |
|
| 697 | second=0, |
|
| 698 | microsecond=0, |
|
| 699 | tzinfo=None) |
|
| 700 | elif current_datetime_utc.month == 12: |
|
| 701 | next_datetime_utc = datetime(year=current_datetime_utc.year + 1, |
|
| 702 | month=1, |
|
| 703 | day=31, |
|
| 704 | hour=current_datetime_utc.hour, |
|
| 705 | minute=current_datetime_utc.minute, |
|
| 706 | second=0, |
|
| 707 | microsecond=0, |
|
| 708 | tzinfo=None) |
|
| 709 | ||
| 710 | sub_total = Decimal(0.0) |
|
| 711 | sub_maximum = None |
|