fix: 清理错误定时策略并支持生成cron文本3

This commit is contained in:
caoqianming 2023-08-07 00:38:55 +08:00
parent 51acf6caa0
commit 4375c344e9
1 changed files with 9 additions and 5 deletions

View File

@ -36,12 +36,16 @@ def correct_myschedule():
elif typeset == 'crontab': elif typeset == 'crontab':
try: try:
crontab = item.crontab crontab = item.crontab
if crontab:
item.name = get_chinese_description(typeset, item.name = get_chinese_description(typeset,
{"minute": crontab.minute, "hour": crontab.hour, "day_of_month": crontab.day_of_month, {"minute": crontab.minute, "hour": crontab.hour, "day_of_month": crontab.day_of_month,
"month_of_year": crontab.month_of_year, "day_of_week": crontab.day_of_week}) "month_of_year": crontab.month_of_year, "day_of_week": crontab.day_of_week})
if item.name == '': if item.name == '':
crontab.delete() crontab.delete()
item.delete() item.delete()
else:
PeriodicTask.objects.filter(gridtaskset_periodictask__myschedule=item).delete()
item.delete()
except ObjectDoesNotExist: except ObjectDoesNotExist:
GridTaskSet.objects.filter(myschedule=item).delete() GridTaskSet.objects.filter(myschedule=item).delete()
item.delete() item.delete()