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