Exemplo n.º 1
0
def add_place_p():
    newPlaceID = Database.add_place(request.form['data_resolution'],
                                    request.form['location_distribution'],
                                    request.form['polygon'],
                                    request.form['place_name'],
                                    session['userObj']['email'])
    return jsonifyResponse({'placeID': str(newPlaceID)})
Exemplo n.º 2
0
def create_study():
    #Insert new Place
    newPlaceID = Database.add_place(request.form['data_resolution'], request.form['location_distribution'],
        request.form['polygon'], request.form['place_name'], session['userObj']['email'])

    # Insert the new study
    newStudyID = Database.studies.insert({
        'study_name': request.form['study_name'],
        'study_question': request.form['study_question'],
        'study_public': request.form['study_public'],
        'places_id': [newPlaceID],
        'owner': session['userObj']['email'],
        })

    session['currentStudy'] = newStudyID
    # Return the ID for the client to rendezvous at /study/populate/<id>
    return jsonifyResponse({
        'studyID': str(newStudyID),
        'placeID': str(newPlaceID)
    })