Esempio n. 1
0
def post_get_many_Question(instance_id=None,
                           search_params=None,
                           result=None,
                           **kw):
    # print("POST_GET_MANY_QUESTION")
    # print("POST_GET", search_params)
    for item in result['objects']:
        item['questionnaire'] = [
            api_manager.url_for(Questionnaire, instid=q['id'])
            for q in item['questionnaire']
        ]
        item['reponses'] = [
            api_manager.url_for(ValeurPossible,
                                q=json.dumps({
                                    "filters": [{
                                        "and": [{
                                            "name": "question_id",
                                            "op": "==",
                                            "val": rep['question_id']
                                        }, {
                                            "name": "question_num",
                                            "op": "eq",
                                            "val": rep['question_num']
                                        }, {
                                            "name": "id",
                                            "op": "eq",
                                            "val": rep['id']
                                        }]
                                    }]
                                })) for rep in item['reponses']
        ]
Esempio n. 2
0
def post_get_many_Sonde(result=None, **kw):
    # print("POST_GET_MANY_SONDE")
    for item in result['objects']:
        item['panels'] = [
            api_manager.url_for(Panel, instid=p['id_panel'])
            for p in item['panels']
        ]
Esempio n. 3
0
def post_get_many_Questionnaire(result=None, **kw):
    for item in result['objects']:
        item['client'] = api_manager.url_for(Client, instid=item['id_client'])
        item['concepteur'] = api_manager.url_for(Utilisateur,
                                                 instid=item['id_concepteur'])
        item['panel'] = api_manager.url_for(Panel, instid=item['id_panel'])
        l_questlink = [
            api_manager.url_for(Question,
                                q=json.dumps({
                                    "filters": [{
                                        "and": [{
                                            "name": "id",
                                            "op": "==",
                                            "val": quest['id']
                                        }, {
                                            "name": "numero",
                                            "op": "eq",
                                            "val": quest['numero']
                                        }]
                                    }]
                                })) for quest in item['questions']
        ]
        item['questions'] = l_questlink
Esempio n. 4
0
def post_get_single_Questionnaire(instance_id=None, result=None, **kw):
    # print("POST_GET_SINGLE_QUESTIONNAIRE")
    result['client'] = api_manager.url_for(Client, instid=result['id_client'])
    result['concepteur'] = api_manager.url_for(Utilisateur,
                                               instid=result['id_concepteur'])
    result['panel'] = api_manager.url_for(Panel, instid=result['id_panel'])

    l_questlink = [
        api_manager.url_for(Question,
                            q=json.dumps({
                                "filters": [{
                                    "and": [{
                                        "name": "id",
                                        "op": "==",
                                        "val": quest['id']
                                    }, {
                                        "name": "numero",
                                        "op": "eq",
                                        "val": quest['numero']
                                    }]
                                }]
                            })) for quest in result['questions']
    ]
    result['questions'] = l_questlink
Esempio n. 5
0
def post_get_many_Panel(result=None, **kw):
    for item in result['objects']:
        item['sondes'] = [
            api_manager.url_for(Sonde, instid=p['id_sonde'])
            for p in item['sondes']
        ]
Esempio n. 6
0
def post_get_single_Panel(result=None, **kw):
    result['sondes'] = [
        api_manager.url_for(Sonde, instid=p['id_sonde'])
        for p in result['sondes']
    ]
Esempio n. 7
0
def post_get_single_Sonde(result=None, **kw):
    # print("POST_GET_SINGLE_SONDE")
    result['panels'] = [
        api_manager.url_for(Panel, instid=p['id_panel'])
        for p in result['panels']
    ]