Beispiel #1
0
def is_mapping_out_of_sync(form_model_doc, dbm):
    form_model = FormModel.new_from_doc(dbm, form_model_doc)
    if form_model.form_code == 'delete':
        return

    submission_search_store = SubmissionSearchStore(dbm,
                                                    form_model,
                                                    old_form_model=None)
    current_mapping = submission_search_store.get_mappings()
    old_mapping = submission_search_store.get_old_mappings()
    return submission_search_store.is_mapping_out_of_sync()
Beispiel #2
0
def check_mapping_out_of_sync(form_model, dbm):
    logger = logging.getLogger('datawinners.tasks')
    if form_model.form_code == 'delete':
        return
    try:
        submission_search_store = SubmissionSearchStore(dbm,
                                                        form_model,
                                                        old_form_model=None)
        current_mapping = submission_search_store.get_mappings()
        old_mapping = submission_search_store.get_old_mappings()
        return submission_search_store.is_mapping_out_of_sync()
    except Exception as e:
        logger.exception('Skipping form model ' + form_model.id)
    return False  #Retrigger after fixing any environment issue