예제 #1
0
 def handle(self, month_years, **options):
     datespan_list = []
     for arg in month_years:
         month_year = dateutil.parser.parse(arg)
         datespan_list.append(DateSpan.from_month(month_year.month, month_year.year))
     generator = MALTTableGenerator(datespan_list)
     print("Building Malt table... for time range {}".format(datespan_list))
     generator.build_table()
     print("Finished!")
예제 #2
0
 def handle(self, *args, **options):
     datespan_list = []
     for arg in args:
         month_year = dateutil.parser.parse(arg)
         datespan_list.append(DateSpan.from_month(month_year.month, month_year.year))
     generator = MALTTableGenerator(datespan_list)
     print "Building Malt table... for time range {}".format(datespan_list)
     generator.build_table()
     print "Finished!"
예제 #3
0
def build_last_month_MALT():
    def _last_month_datespan():
        today = datetime.date.today()
        first_of_this_month = datetime.date(day=1, month=today.month, year=today.year)
        last_month = first_of_this_month - datetime.timedelta(days=1)
        return DateSpan.from_month(last_month.month, last_month.year)

    last_month = _last_month_datespan()
    generator = MALTTableGenerator([last_month])
    generator.build_table()

    message = (
        "MALT generation for month {} is now ready. To download go to"
        " http://www.commcarehq.org/hq/admin/download_malt/".format(last_month)
    )
    send_HTML_email("MALT is ready", settings.DATA_EMAIL, message, text_content=message)
예제 #4
0
def build_last_month_MALT():
    def _last_month_datespan():
        today = datetime.date.today()
        first_of_this_month = datetime.date(day=1,
                                            month=today.month,
                                            year=today.year)
        last_month = first_of_this_month - datetime.timedelta(days=1)
        return DateSpan.from_month(last_month.month, last_month.year)

    last_month = _last_month_datespan()
    generator = MALTTableGenerator([last_month])
    generator.build_table()

    message = 'MALT generation for month {} is now ready. To download go to'\
              ' http://www.commcarehq.org/hq/admin/download_malt/'.format(
                  last_month
              )
    send_HTML_email('MALT is ready',
                    settings.DATA_EMAIL,
                    message,
                    text_content=message)
예제 #5
0
 def run_malt_generation(cls):
     generator = MALTTableGenerator([cls.malt_month])
     generator.build_table()
예제 #6
0
def update_current_MALT():
    today = datetime.date.today()
    this_month = DateSpan.from_month(today.month, today.year)
    MALTTableGenerator([this_month]).build_table()
예제 #7
0
 def run_malt_generation(cls):
     generator = MALTTableGenerator([cls.malt_month])
     generator.build_table()