示例#1
0
文件: app.py 项目: rmoorman/progcom
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'
    l.vote(request.user.id, id, scores, nominate)
    return render_template('user_vote_snippet.html', 
                            standards=l.get_standards(),
                            votes = l.get_votes(id),
                            existing_vote=l.get_user_vote(request.user.id, id))
示例#2
0
文件: app.py 项目: pgagnon/progcom
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'
    l.vote(request.user.id, id, scores, nominate)
    return render_template('user_vote_snippet.html',
                           standards=l.get_standards(),
                           votes=l.get_votes(id),
                           existing_vote=l.get_user_vote(request.user.id, id))
示例#3
0
文件: app.py 项目: pgagnon/progcom
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)
示例#4
0
文件: app.py 项目: rmoorman/progcom
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)
示例#5
0
文件: app.py 项目: aldeka/progcom
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,
    )
示例#6
0
文件: app.py 项目: pgagnon/progcom
def show_votes():
    votes = l.get_my_votes(request.user.id)
    votes = [x._replace(updated_on=l._js_time(x.updated_on)) for x in votes]
    percent = l.get_vote_percentage(request.user.email, request.user.id)
    return render_template('my_votes.html',
                           votes=votes,
                           percent=percent,
                           standards=l.get_standards())
示例#7
0
def main():
    lt.transact()
    emails = ['user{}@example.com'.format(n) for n in range(50)]
    for e in emails[:25]:
        uid = l.add_user(e, '{} Person'.format(e.split('@')[0]), 'abc123')
        l.approve_user(uid)


    for n in range(6):
        l.add_standard(words(3, 10)[:50])

    user_ids = [x.id for x in l.list_users()]
    standards = [x.id for x in l.get_standards()]
    
    proposal_ids = []
    for n in range(200):
        prop_id = n*2
        data = {'id': prop_id, 'authors': [{'email': random.choice(emails),
                                        'name': 'Speaker Name Here'}],
                'title': words(3,8).title(),
                'category': words(1,2),
                'duration': '30 minutes',
                'description': ipsum(4),
                'audience': ipsum(1),
                'audience_level': 'Novice',
                'notes': ipsum(2),
                'objective': ipsum(1),
                'recording_release': bool(random.random() > 0.05),
                'abstract': ipsum(1),
                'outline': ipsum(5)+"\n[test](http://www.google.com/)\n",
                'additional_notes': ipsum(1),
                'additional_requirements': ipsum(1)}
        l.add_proposal(data)
        proposal_ids.append(prop_id)

        if random.randint(0, 3) == 0:
            for n in range(random.randint(1, 10)):
                l.add_to_discussion(random.choice(user_ids), prop_id, ipsum(1))

        if random.randint(0, 2) == 0:
            for n in range(random.randint(1, 5)):
                vote = {k:random.randint(0, 2) for k in standards}
                l.vote(random.choice(user_ids), prop_id, vote)

        if random.randint(0, 3) == 0:
            data['description'] = 'UPDATED ' + ipsum(4)
            l.add_proposal(data)


    random.shuffle(proposal_ids)

    proposal_ids = proposal_ids[:70]
    for n in range(0, len(proposal_ids), 5):
        l.create_group(words(2,4).title(),
                proposal_ids[n:n+5])
示例#8
0
文件: app.py 项目: aldeka/progcom
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
示例#9
0
def main():
    lt.transact()
    emails = ["user{}@example.com".format(n) for n in range(50)]
    for e in emails[:25]:
        uid = l.add_user(e, "{} Person".format(e.split("@")[0]), "abc123")
        l.approve_user(uid)

    for n in range(6):
        l.add_standard(words(3, 10)[:50])

    user_ids = [x.id for x in l.list_users()]
    standards = [x.id for x in l.get_standards()]

    proposal_ids = []
    for n in range(200):
        prop_id = n * 2
        data = {
            "id": prop_id,
            "authors": [{"email": random.choice(emails), "name": "Speaker Name Here"}],
            "title": words(3, 8).title(),
            "category": words(1, 2),
            "duration": "30 minutes",
            "description": ipsum(4),
            "audience": ipsum(1),
            "audience_level": "Novice",
            "notes": ipsum(2),
            "objective": ipsum(1),
            "recording_release": bool(random.random() > 0.05),
            "abstract": ipsum(1),
            "outline": ipsum(5) + "\n[test](http://www.google.com/)\n",
            "additional_notes": ipsum(1),
            "additional_requirements": ipsum(1),
        }
        l.add_proposal(data)
        proposal_ids.append(prop_id)

        if random.randint(0, 3) == 0:
            for n in range(random.randint(1, 10)):
                l.add_to_discussion(random.choice(user_ids), prop_id, ipsum(1))

        if random.randint(0, 2) == 0:
            for n in range(random.randint(1, 5)):
                vote = {k: random.randint(0, 2) for k in standards}
                l.vote(random.choice(user_ids), prop_id, vote)

        if random.randint(0, 3) == 0:
            data["notes"] = "UPDATED" + ipsum(2)
            l.add_proposal(data)

    random.shuffle(proposal_ids)

    proposal_ids = proposal_ids[:70]
    for n in range(0, len(proposal_ids), 5):
        l.create_group(words(2, 4).title(), proposal_ids[n : n + 5])
示例#10
0
def main():
    lt.transact()
    emails = ['user{}@example.com'.format(n) for n in range(50)]
    for e in emails[:25]:
        uid = l.add_user(e, '{} Person'.format(e.split('@')[0]), 'abc123')
        l.approve_user(uid)


    """
    for n in range(6):
        l.add_standard(words(3, 10)[:50])
    """
    standards = ["follows PyCon's Code of Conduct",
                "is complete, clearly written, and articulate",
                "has a thorough and achievable outline",
                "has a coherent and primarily technical subject",
                "is about the Python ecosystem",
                "has a sufficient audience among attendees"]
    for s in standards:
        l.add_standard(s)

    user_ids = [x.id for x in l.list_users()]
    standards = [x.id for x in l.get_standards()]
    
    proposal_ids = []
    for n in range(200):
        prop_id = n*2
        data = {'id': prop_id, 'authors': [{'email': random.choice(emails),
                                        'name': 'Speaker Name Here'}],
                'title': words(3,8).title(),
                'category': words(1,2),
                'duration': '30 minutes',
                'description': ipsum(4),
                'audience': ipsum(1),
                'audience_level': 'Novice',
                'notes': ipsum(2),
                'objective': ipsum(1),
                'recording_release': bool(random.random() > 0.05),
                'abstract': ipsum(1),
                'outline': ipsum(5)+"\n[test](http://www.google.com/)\n",
                'additional_notes': ipsum(1),
                'additional_requirements': ipsum(1)}
        l.add_proposal(data)
        proposal_ids.append(prop_id)

        if random.randint(0, 3) == 0:
            for n in range(random.randint(1, 10)):
                l.add_to_discussion(random.choice(user_ids), prop_id, ipsum(1))

        if random.randint(0, 2) == 0:
            for n in range(random.randint(1, 5)):
                vote = {k:random.randint(0, 2) for k in standards}
                l.vote(random.choice(user_ids), prop_id, vote)

        if random.randint(0, 3) == 0:
            data['notes'] = 'UPDATED' + ipsum(2)
            l.add_proposal(data)


    random.shuffle(proposal_ids)

    proposal_ids = proposal_ids[:70]
    for n in range(0, len(proposal_ids), 5):
        l.create_group(words(2,4).title(),
                proposal_ids[n:n+5])
示例#11
0
文件: app.py 项目: rmoorman/progcom
def show_votes():
    votes = l.get_my_votes(request.user.id)
    votes = [x._replace(updated_on=l._js_time(x.updated_on)) for x in votes]
    percent = l.get_vote_percentage(request.user.email, request.user.id)
    return render_template('my_votes.html', votes=votes, percent=percent,
                            standards = l.get_standards())
示例#12
0
文件: app.py 项目: cczona/progcom
def show_votes():
    votes = l.get_my_votes(request.user.id)
    percent = l.get_vote_percentage(request.user.email, request.user.id)
    return render_template('my_votes.html', votes=votes, percent=percent,
                            standards = l.get_standards())
示例#13
0
文件: logic_test.py 项目: njl/progcom
def test_standards():
    assert l.get_standards() == []
    l.add_standard('Bob')
    assert l.get_standards()[0].description == 'Bob'
示例#14
0
文件: app.py 项目: aldeka/progcom
def show_votes():
    votes = l.get_my_votes(request.user.id)
    percent = 100.0 * len(votes) / l.get_proposal_count()
    return render_template("my_votes.html", votes=votes, percent=percent, standards=l.get_standards())
示例#15
0
文件: app.py 项目: themson/progcom
def list_standards():
    return render_template('standards.html', standards=l.get_standards())
示例#16
0
def test_standards():
    assert l.get_standards() == []
    l.add_standard('Bob')
    assert l.get_standards()[0].description == 'Bob'
示例#17
0
def test_standards():
    assert l.get_standards() == []
    l.add_standard("Bob")
    assert l.get_standards()[0].description == "Bob"