コード例 #1
0
def match_test():
    print session
    query = {'location': '', 'langs': [], 'skills': [], 'fulltext': 'NYU'}
    if 'user-expertise' not in session:
        session['user-expertise'] = {}
    experts = db.findMatchAsJSON(session['user-expertise'])
    return render_template('test.html', **{'title': 'Matching search', 'results': experts, 'query': query})
コード例 #2
0
def match():
    if 'user-expertise' not in session:
        flash('Before we can match you with fellow innovators, you need to <a href="/my-expertise">enter your expertise</a> first.', 'error')
        return redirect(url_for('main_page'))
    social_login = session['social-login']
    userid = social_login['userid']
    query = {'location': '', 'langs': [], 'skills': [], 'fulltext': ''}
    if 'skills' not in session['user-expertise']:
        userProfile = db.getUser(userid)
        userExpertise = userProfile['skills']
        session['user-expertise'] = userExpertise
    print "user expertise: ", json.dumps(session['user-expertise'])
    skills = session['user-expertise']
    my_needs = [k for k,v in skills.iteritems() if int(v) == -1]
    print my_needs
    experts = db.findMatchAsJSON(my_needs)
    session['has_done_search'] = True
    return render_template('search-results.html', **{'title': 'People Who Know what I do not', 'results': experts, 'query': query})