def store_additional_questionnaire_answers(session, tid, tip_id, answers, language): itip = session.query(models.InternalTip) \ .filter(models.InternalTip.id == tip_id, models.InternalTip.status != 'closed', models.InternalTip.tid == tid).one() if not itip.additional_questionnaire_id: return steps = db_get_questionnaire(session, tid, itip.additional_questionnaire_id, None)['steps'] questionnaire_hash = db_archive_questionnaire_schema(session, steps) db_save_plaintext_answers(session, tid, itip.id, answers, itip.crypto_tip_pub_key != '') if itip.crypto_tip_pub_key: answers = base64.b64encode( GCE.asymmetric_encrypt(itip.crypto_tip_pub_key, json.dumps(answers).encode())).decode() db_set_internaltip_answers(session, itip.id, questionnaire_hash, answers) itip.additional_questionnaire_id = ''
def store_additional_questionnaire_answers(session, tid, tip_id, answers, language): internaltip = session.query(models.InternalTip) \ .filter(models.InternalTip.id == tip_id, models.InternalTip.tid == tid).one() if not internaltip.additional_questionnaire_id: return steps = db_get_questionnaire(session, tid, internaltip.additional_questionnaire_id, None)['steps'] questionnaire_hash = db_archive_questionnaire_schema(session, steps) db_save_questionnaire_answers(session, tid, internaltip.id, answers) db_set_internaltip_answers(session, internaltip.id, questionnaire_hash, answers, False) internaltip.additional_questionnaire_id = ''