"""
@author: luojunhui
"""
from argparse import ArgumentParser

from tasks.update_published_articles_read_detail import UpdatePublishedArticlesReadDetail


def main():
    """
    update mini program detail main
    :return:
    """
    parser = ArgumentParser()
    parser.add_argument("--run-date",
                        help="Run only once for date in format of %Y-%m-%d. \
                            If no specified, run as daily jobs.")
    args = parser.parse_args()

    update_publish_articles_task = UpdatePublishedArticlesReadDetail()
    update_publish_articles_task.init_database()

    if args.run_date:
        update_publish_articles_task.update_job(args.run_date)
        update_publish_articles_task.check_job(args.run_date)
    else:
        update_publish_articles_task.update_job()
        update_publish_articles_task.check_job()

    update_publish_articles_task.get_article_detail_job()


if __name__ == '__main__':
    main()
