示例#1
0
 def handle(self, *args, **options):
     accepted_proposals = ProposalResult.objects.filter(status="accepted")
     accepted_proposals = accepted_proposals.order_by("proposal")
     
     for result in accepted_proposals:
         promote_proposal(result.proposal)
     connections["default"].cursor().execute("SELECT setval('schedule_session_id_seq', (SELECT max(id) FROM schedule_session))")
示例#2
0
 def handle(self, *args, **options):
     accepted_proposals = ProposalResult.objects.filter(accepted=True)
     accepted_proposals = accepted_proposals.order_by("proposal")
     
     for result in accepted_proposals:
         promote_proposal(result.proposal)
     connections["default"].cursor().execute("SELECT setval('schedule_session_id_seq', (SELECT max(id) FROM schedule_session))")
示例#3
0
    def test_additional_speaker_enables_item(self):
        self._create_proposals()
        self._create_flag_for_additional_speaker()

        # USER_2 cannot see PROD_1 until proposal is promoted.
        available = ProductController.available_products(
            self.USER_2,
            products=[self.PROD_1],
        )
        self.assertNotIn(self.PROD_1, available)

        # promote proposal_1 so that USER_2 becomes an additional speaker
        promote_proposal(self.PROPOSAL_1)

        # USER_2 can see PROD_1
        available_2 = ProductController.available_products(
            self.USER_2,
            products=[self.PROD_1],
        )
        self.assertIn(self.PROD_1, available_2)
        # USER_1 can *NOT* see PROD_1 because they're a presenter
        available_1 = ProductController.available_products(
            self.USER_1,
            products=[self.PROD_1],
        )
        self.assertNotIn(self.PROD_1, available_1)
示例#4
0
    def test_proposal_cancelled_disables_condition(self):
        self._create_proposals()
        self._create_flag_for_primary_speaker()

        # USER_1 cannot see PROD_1 until proposal is promoted.
        available = ProductController.available_products(
            self.USER_1,
            products=[self.PROD_1],
        )
        self.assertNotIn(self.PROD_1, available)

        # promote proposal_1 so that USER_1 becomes a speaker
        promote_proposal(self.PROPOSAL_1)
        presentation = schedule_models.Presentation.objects.get(
            proposal_base=self.PROPOSAL_1
        )
        presentation.cancelled = True
        presentation.save()

        # USER_1 can *NOT* see PROD_1 because proposal_1 has been cancelled
        available_after_cancelled = ProductController.available_products(
            self.USER_1,
            products=[self.PROD_1],
        )
        self.assertNotIn(self.PROD_1, available_after_cancelled)
示例#5
0
    def test_speaker_on_different_proposal_kind_does_not_enable_item(self):
        self._create_proposals()
        self._create_flag_for_primary_speaker()

        # USER_1 cannot see PROD_1 until proposal is promoted.
        available = ProductController.available_products(
            self.USER_1,
            products=[self.PROD_1],
        )
        self.assertNotIn(self.PROD_1, available)

        # promote proposal_2 so that USER_1 becomes a speaker, but of
        # KIND_2, which is not covered by this condition
        promote_proposal(self.PROPOSAL_2)

        # USER_1 cannot see PROD_1
        available_1 = ProductController.available_products(
            self.USER_1,
            products=[self.PROD_1],
        )
        self.assertNotIn(self.PROD_1, available_1)
def assign_presentation(slot, section, proposal_id):
    try:
        proposal = ProposalBase.objects.get(pk=proposal_id)
    except ProposalBase.DoesNotExist:
        print 'No proposal found with pk %s, skipping' % proposal_id
        return
    presentation = promote_proposal(proposal)
    presentation.slot = slot
    presentation.section = section
    presentation.save()
    print 'assigning presentation for %s' % proposal_id
    slot.assign(presentation)
示例#7
0
def assign_presentation(slot, section, proposal_id):
    try:
        proposal = ProposalBase.objects.get(pk=proposal_id)
    except ProposalBase.DoesNotExist:
        print 'No proposal found with pk %s, skipping' % proposal_id
        return
    presentation = promote_proposal(proposal)
    presentation.slot = slot
    presentation.section = section
    presentation.save()
    print 'assigning presentation for %s' % proposal_id
    slot.assign(presentation)
 def handle(self, *args, **options):
     accepted_sprints = SprintProposal.objects.filter(result__status='accepted')
     for sprint in accepted_sprints:
         promote_proposal(sprint)
 def handle(self, *args, **options):
     accepted_sprints = SprintProposal.objects.filter(result__status='accepted')
     for sprint in accepted_sprints:
         promote_proposal(sprint)
示例#10
0
def review_detail(request, pk):

    proposals = ProposalBase.objects.select_related(
        "result").select_subclasses()
    proposal = get_object_or_404(proposals, pk=pk)

    if not request.user.has_perm(
            "reviews.can_review_%s" % proposal.kind.section.slug):
        return access_not_permitted(request)

    speakers = [s.user for s in proposal.speakers()]

    if not request.user.is_superuser and request.user in speakers:
        return access_not_permitted(request)

    admin = request.user.has_perm("reviews.can_manage_%s" %
                                  proposal.kind.section.slug)

    try:
        latest_vote = LatestVote.objects.get(proposal=proposal,
                                             user=request.user)
    except LatestVote.DoesNotExist:
        latest_vote = None

    if request.method == "POST":
        if request.user in speakers:
            return access_not_permitted(request)

        if "vote_submit" in request.POST or "vote_submit_and_random" in request.POST:
            review_form = ReviewForm(request.POST)
            if review_form.is_valid():

                review = review_form.save(commit=False)
                review.user = request.user
                review.proposal = proposal
                review.save()

                if "vote_submit_and_random" in request.POST:
                    next_page = redirect("user_random",
                                         proposal.kind.section.slug)
                    next_page["Location"] += "#invalid_fragment"  # Hack.
                else:
                    next_page = redirect(request.path)

                return next_page
            else:
                message_form = SpeakerCommentForm()
        elif "message_submit" in request.POST and admin:
            message_form = SpeakerCommentForm(request.POST)
            if message_form.is_valid():

                message = message_form.save(commit=False)
                message.user = request.user
                message.proposal = proposal
                message.save()

                for speaker in speakers:
                    if speaker and speaker.email:
                        ctx = {
                            "proposal": proposal,
                            "message": message,
                            "reviewer": False,
                        }
                        send_email([speaker.email],
                                   "proposal_new_message",
                                   context=ctx)

                return redirect(request.path)
            else:
                initial = {}
                if latest_vote:
                    initial["vote"] = latest_vote.vote
                if request.user in speakers:
                    review_form = None
                else:
                    review_form = ReviewForm(initial=initial)
        elif "result_submit" in request.POST:
            if admin:
                result = request.POST["result_submit"]

                if result == "accept":
                    proposal.result.status = "accepted"
                    proposal.result.save()
                elif result == "reject":
                    proposal.result.status = "rejected"
                    proposal.result.save()
                elif result == "undecide":
                    proposal.result.status = "undecided"
                    proposal.result.save()
                elif result == "standby":
                    proposal.result.status = "standby"
                    proposal.result.save()
                return redirect(request.path)
        elif "publish_changes" in request.POST:
            if admin and proposal.result.status == "accepted":
                promote_proposal(proposal)
                return redirect(request.path)
    else:
        initial = {}
        if latest_vote:
            initial["vote"] = latest_vote.vote
        if request.user in speakers:
            review_form = None
        else:
            review_form = ReviewForm(initial=initial)
        message_form = SpeakerCommentForm()

    proposal.comment_count = proposal.result.comment_count
    proposal.total_votes = proposal.result.vote_count
    proposal.plus_two = proposal.result.plus_two
    proposal.plus_one = proposal.result.plus_one
    proposal.minus_one = proposal.result.minus_one
    proposal.minus_two = proposal.result.minus_two

    reviews = Review.objects.filter(
        proposal=proposal).order_by("-submitted_at")
    messages = proposal.messages.order_by("submitted_at")

    return render(
        request, "symposion/reviews/review_detail.html", {
            "proposal": proposal,
            "latest_vote": latest_vote,
            "reviews": reviews,
            "review_messages": messages,
            "review_form": review_form,
            "message_form": message_form,
            "is_manager": admin
        })