def test_voting_basics(): l.add_proposal(data) standards = [l.add_standard("About Pythong"), l.add_standard("Awesome")] uid = l.add_user('*****@*****.**', 'Bob', 'bob') assert not l.get_votes(123) assert not l.vote(uid, 123, {k:3 for k in standards}) assert not l.get_votes(123) assert l.get_proposal(123).vote_count == 0 l.approve_user(uid) assert not l.vote(uid, 123, {}) assert not l.get_votes(123) assert l.vote(uid, 123, {k:2 for k in standards}) assert l.get_votes(123)[0].scores == {k:2 for k in standards} assert l.get_proposal(123).vote_count == 1 assert not l.vote(uid, 123, {k:7 for k in standards}) assert l.get_votes(123)[0].scores == {k:2 for k in standards} assert l.vote(uid, 123, {k:0 for k in standards}) assert len(l.get_votes(123)) == 1 assert l.get_votes(123)[0].scores == {k:0 for k in standards} assert l.get_proposal(123).vote_count == 1
def test_voting_basics(): l.add_proposal(data) standards = [l.add_standard("About Pythong"), l.add_standard("Awesome")] uid = l.add_user('*****@*****.**', 'Bob', 'bob') assert not l.get_votes(123) assert not l.vote(uid, 123, {k: 3 for k in standards}) assert not l.get_votes(123) assert l.get_proposal(123).vote_count == 0 l.approve_user(uid) assert not l.vote(uid, 123, {}) assert not l.get_votes(123) assert l.vote(uid, 123, {k: 2 for k in standards}) assert l.get_votes(123)[0].scores == {k: 2 for k in standards} assert l.get_proposal(123).vote_count == 1 assert not l.vote(uid, 123, {k: 7 for k in standards}) assert l.get_votes(123)[0].scores == {k: 2 for k in standards} assert l.vote(uid, 123, {k: 0 for k in standards}) assert len(l.get_votes(123)) == 1 assert l.get_votes(123)[0].scores == {k: 0 for k in standards} assert l.get_proposal(123).vote_count == 1
def screening(id): proposal = l.get_proposal(id) if not proposal or proposal.withdrawn: abort(404) if request.user.email in (x.email.lower() for x in proposal.authors): abort(404) unread = l.is_unread(request.user.id, id) discussion = l.get_discussion(id) standards = l.get_standards() progress = l.screening_progress() bookmarked = l.has_bookmark(request.user.id, id) existing_vote = l.get_user_vote(request.user.id, id) votes = l.get_votes(id) return render_template( "screening_proposal.html", proposal=proposal, votes=votes, discussion=discussion, standards=standards, progress=progress, bookmarked=bookmarked, existing_vote=existing_vote, unread=unread, )
def view_single_proposals(id): proposal = l.get_proposal(id) if request.user.email in [x.email for x in proposal.authors]: abort(404) return render_template('batch/single_proposal.html', proposal=proposal, discussion=l.get_discussion(id))
def author_feedback(key): name, id = l.check_author_key(key) if not name: return render_template('bad_feedback_key.html') proposal = l.get_proposal(id) return render_template('author_feedback.html', name=name, proposal=proposal, messages=l.get_discussion(id))
def screening(id): l.l('screening_view', uid=request.user.id, id=id) proposal = l.get_proposal(id) if not proposal or proposal.withdrawn: abort(404) if request.user.email in (x.email.lower() for x in proposal.authors): abort(404) unread = l.is_unread(request.user.id, id) discussion = l.get_discussion(id) standards = l.get_standards() existing_vote = l.get_user_vote(request.user.id, id) votes = l.get_votes(id) my_votes = l.get_my_votes(request.user.id) percent = l.get_vote_percentage(request.user.email, request.user.id) return render_template('screening_proposal.html', proposal=proposal, votes=votes, discussion=discussion, standards=standards, existing_vote=existing_vote, unread=unread, percent=percent)
def screening(id): l.l('screening_view', uid=request.user.id, id=id) proposal = l.get_proposal(id) if not proposal or proposal.withdrawn: abort(404) if request.user.email in (x.email.lower() for x in proposal.authors): abort(404) unread = l.is_unread(request.user.id, id) discussion = l.get_discussion(id) standards = l.get_standards() bookmarked = l.has_bookmark(request.user.id, id) existing_vote = l.get_user_vote(request.user.id, id) votes = l.get_votes(id) my_votes = l.get_my_votes(request.user.id) percent = l.get_vote_percentage(request.user.email, request.user.id) return render_template('screening_proposal.html', proposal=proposal, votes=votes, discussion=discussion, standards=standards, bookmarked=bookmarked, existing_vote=existing_vote, unread=unread, percent=percent)
def test_proposal_basics(): assert l.add_proposal(data) assert not l.add_proposal(data) assert l.get_proposal(data['id']).data['outline'] == data['outline'] changed = data.copy() changed['abstract'] = 'This is a longer abstract.' assert l.add_proposal(changed)
def test_proposal_basics(): assert l.add_proposal(data) assert not l.add_proposal(data) assert l.get_proposal(data['id']).outline == data['outline'] changed = data.copy() changed['abstract'] = 'This is a longer abstract.' assert l.add_proposal(changed)
def test_proposal_basics(): assert l.add_proposal(data) assert not l.add_proposal(data) assert l.get_proposal(data["id"]).outline == data["outline"] changed = data.copy() changed["abstract"] = "This is a longer abstract." assert l.add_proposal(changed)
def vote(id): standards = l.get_standards() scores = {} for s in standards: scores[s.id] = int(request.values["standard-{}".format(s.id)]) nominate = request.values.get("nominate", "0") == "1" redir = redirect(url_for("screening", id=id)) if l.vote(request.user.id, id, scores, nominate): proposal = l.get_proposal(id) return redir return redir
def confirmation(key): id = l.acknowledge_confirmation(key) if not id: return render_template('bad_feedback_key.html') return render_template('confirmation.html', proposal=l.get_proposal(id))
def remove_bookmark(id): l.remove_bookmark(request.user.id, id) return render_template('proposal_snippet.html', proposal=l.get_proposal(id), bookmarked=l.has_bookmark(request.user.id, id))