from tqdm import tqdm

from patch.include import *

import phonenumbers


@app_context(commit=True)
def patch():
    for task in tqdm(models.CmfTask.list(filter=[['cache_fields', '==', None], ['status.status_type', '!=', 'closed']])):
        task.save(only_data=True)
    for task in tqdm(models.CmfDeal.list(filter=[['cache_fields', '==', None], ['status.status_type', '!=', 'closed']])):
        task.save(only_data=True)


if __name__ == "__main__":
    patch()
