コード例 #1
0
    def test_delete_question_and_answers(self):
        c = self.mk_conference()
        q = confquestion.mk_question(c.key, "How are you?")
        q.add_option("Good")
        q.add_option("Bad")

        self.assertEquals(1, len(confquestion.retrieve_questions(c.key)))
        confquestion.delete_question_and_answers(q)
        self.assertEquals(0, len(confquestion.retrieve_questions(c.key)))
コード例 #2
0
    def test_retrieve_questions(self):
        c = self.mk_conference()
        questions = confquestion.retrieve_questions(c.key)
        self.assertEquals(0, len(questions))

        q = confquestion.mk_question(c.key, "How are you?")
        questions = confquestion.retrieve_questions(c.key)
        self.assertEquals(1, len(questions))
        self.assertEquals("How are you?", questions[0].question_text())

        q2 = confquestion.mk_question(c.key, "What day is it?")
        questions = confquestion.retrieve_questions(c.key)
        self.assertEquals(2, len(questions))
コード例 #3
0
    def render_page(self, readonly, enable_controls, confidential):
        submission_key = ndb.Key(urlsafe=self.request.get("k"))
        submission = submission_key.get()
        conference = submission_key.parent().get()
        speakers = [submission.talk.parent().get()]
        cospeakers = cospeaker.get_cospeakers(submission_key)
        for cospeak in cospeakers:
            speakers = speakers + [cospeak.profile()]

        conf_questions = confquestion.retrieve_questions(conference.key)
        conf_answers = submission_ans.retrieve_answer_map(submission_key, map(lambda q: q.key, conf_questions))

        template_values = {
            "submission": submission,
            "talk_details": submission.talk.get(),
            "speakers": speakers,
            "readonly": readonly,
            "reviews": roundreviews.retrieve_all_reviews(submission),
            "submissionrecord_track": conference.track_options()[submission.track],
            "submissionrecord_duration": conference.duration_options()[submission.duration],
            "submissionrecord_format": conference.delivery_format_options()[submission.delivery_format],
            "submissionrecord_expenses": conference.expenses_options()[submission.expense_expectations],
            "cospeakers": cospeakers,
            "cospeakers_count": len(cospeakers),
            "enable_controls" : enable_controls,
            "emaillocked": "disabled",
            "show_confidential": confidential,
            "retrieve_vote_comment": votecomment.retrieve_vote_comment,
            "retrieve_comment_text": votecomment.retrieve_comment_text,
            "conf_questions": conf_questions,
            "conf_answers": conf_answers,
        }

        self.write_page('subreview_lib/reviewdetailspage.html', template_values)
コード例 #4
0
    def show_single_submit_page(self):
        if self.submissions_exceeded():
            sorrypage.redirect_sorry(self, "SubsLimitReached")
            return

        conf_questions = confquestion.retrieve_questions(self.crrt_conf.key)
        conf_answers = submission_ans.retrieve_answer_map(
            None, map(lambda q: q.key, conf_questions))

        template_values = {
            "crrt_conf": self.crrt_conf,
            # Speaker fields
            'new_speaker': True,
            'speaker': self.submitter,
            "emaillocked": "readonly",
            'speakerKey': "",
            'readonly': "",
            # Talk fields
            "talk_details": talk.Talk(parent=None),
            "is_new": True,
            "talk_key": None,
            # Conference submission fields
            "selected_track": self.crrt_conf.track_options().keys()[0],
            "selected_duration": self.crrt_conf.duration_options().keys()[0],
            "selected_format":
            self.crrt_conf.delivery_format_options().keys()[0],
            "selected_expenses": self.crrt_conf.expenses_options().keys()[0],
            "conf_questions": conf_questions,
            "conf_answers": conf_answers,
        }

        self.write_page('submission_lib/singlesubmitpage.html',
                        template_values)
コード例 #5
0
    def get(self):
        conference_key = self.retrieve_conf_key()

        if self.request.params.has_key("f"):
            submissions, filter_description = self.retrieve_submissions(
                conference_key, self.request.get("f"))
        else:
            submissions = []
            filter_description = "No filter set"

        if self.request.params.has_key("allfields"):
            all_fields = "ALL"
        else:
            all_fields = ""

        template_values = {
            "crrt_conference": conference_key.get(),
            "submissions": submissions,
            "name": self.get_crrt_user().email(),
            "conf_safe_key": conference_key.urlsafe(),
            "all_fields": all_fields,
            "get_cospeakers_func": cospeaker.get_pretty_list,
            "custom_message":
            custommsg.retrieve_custom_message(conference_key),
            "taglist": tags.taglist_func,
            "conf_questions": confquestion.retrieve_questions(conference_key),
            "retrieve_answer": submission_ans.retrieve_answer,
            "filter_description": filter_description,
            "custom_reports":
            customexport.list_all_report_names(conference_key),
        }

        self.write_page('reports/speakercommspage.html', template_values)
コード例 #6
0
    def get_values_from_talk(self, conferences):
        talk_key = ndb.Key(urlsafe=self.request.get("talk"))

        if self.request.params.has_key("conf"):
            crrt_conference = ndb.Key(urlsafe=self.request.get("conf")).get()
        else:
            crrt_conference = conferences[0]

        sub_key = None
        conf_questions = confquestion.retrieve_questions(crrt_conference.key)
        conf_answers = submission_ans.retrieve_answer_map(
            sub_key, map(lambda q: q.key, conf_questions))

        return {
            "talk_key":
            talk_key,
            "talk":
            talk_key.get(),
            "submitter":
            self.get_crrt_user().email(),
            "sub_key":
            sub_key,
            "sub_key_safe":
            "Nil",
            "available_conferences":
            conferences,
            "crrt_conf":
            crrt_conference,
            "selected_track":
            crrt_conference.track_options().keys()[0],
            "selected_duration":
            crrt_conference.duration_options().keys()[0],
            "selected_format":
            crrt_conference.delivery_format_options().keys()[0],
            "selected_expenses":
            crrt_conference.expenses_options().keys()[0],
            "withdrawn":
            False,
            "agree_privacy":
            False,
            "privacy_agreement_lock":
            "",  # once agreed to it cannot be resinded
            "cospeakers": [],
            "cospeakers_count":
            0,
            "submissions_count":
            submission_queries.count_submissions(crrt_conference.key,
                                                 talk_key.parent()),
            "change_authority":
            False,
            "is_submitter":
            True,
            "conf_questions":
            conf_questions,
            "conf_answers":
            conf_answers,
            "created":
            datetime.datetime.now(),
        }
コード例 #7
0
    def get(self):
        if not (self.request.params.has_key("sub")):
            self.response.write("Sorry, you shouldn't have been able to get here like that.")
            return

        submission_key = ndb.Key(urlsafe=self.request.get("sub"))
        submission = submission_key.get()

        conference = submission_key.parent().get()
        cospeakers = cospeaker.get_cospeakers(submission_key)

        speakers = [submission.talk.parent().get()]
        for cospeak in cospeakers:
            speakers = speakers + [cospeak.profile()]

        review_round = int(self.request.get("round"))
        user = self.get_crrt_user().email()
        existing_vote = voterecord.find_existing_vote_by_reviewer(submission_key, user, round=review_round)

        if existing_vote is not None:
            vote_safe_key = existing_vote.key.urlsafe()
            existing_score = existing_vote.score
            existing_comment = existing_vote.comment
            private_comment = votecomment.retrieve_comment_text(existing_vote.key)
        else:
            vote_safe_key = ""
            existing_score = 0
            existing_comment = ""
            private_comment = ""

        conf_questions = confquestion.retrieve_questions(conference.key)
        conf_answers = self.conference_answers(conf_questions, submission_key)

        template_values = {
            "speakers": speakers,
            "readonly": "readonly",
            "talk_details": submission.talk.get(),
            "submissionrecord_track": conference.track_options()[submission.track],
            "submissionrecord_duration": conference.duration_options()[submission.duration],
            "submissionrecord_format": conference.delivery_format_options()[submission.delivery_format],
            "submissionrecord_expenses": conference.expenses_options()[submission.expense_expectations],
            "submissionrecord_key": submission_key.urlsafe(),
            "submission": submission,
            "cospeakers": cospeakers,
            "cospeakers_count": len(cospeakers),
            "voterecord": vote_safe_key,
            "existing_score": existing_score,
            "existing_comment": existing_comment,
            "private_comment": private_comment,
            "emaillocked": "disabled",
            "submission": submission,
            "conf_questions": conf_questions,
            "conf_answers": conf_answers,
            "review_round": review_round,
        }

        self.write_page('subreview_lib/classicsubscoring.html', template_values)
コード例 #8
0
    def get(self):
        crrt_conf_key = self.get_crrt_conference_key()

        conf_questions = confquestion.retrieve_questions(crrt_conf_key)
        conf_answers = submission_ans.retrieve_answer_map(None, map(lambda q: q.key, conf_questions))

        template_values = { "crrt_conf" : crrt_conf_key.get(),
                            "speaker" : ndb.Key(urlsafe=self.request.get("speaker_key")).get(),
                            "talk": ndb.Key(urlsafe=self.request.get("talk_key")).get(),
                            "conf_questions": conf_questions,
                            "conf_answers": conf_answers,
                            }
        self.write_page('submission_lib/flowpage3.html', template_values)
コード例 #9
0
    def get_existing_values(self):
        sub_key = ndb.Key(urlsafe=self.request.get("sub"))
        sub = sub_key.get()
        reviews = roundreviews.retrieve_all_reviews(sub)
        cospeak = cospeaker.get_cospeakers(sub_key)

        readonly = ""
        disabled = ""
        change_authority = False
        is_submitter = True
        crrt_conf = sub_key.parent().get()
        logging.info(self.get_crrt_user().email() + "----" +
                     sub.talk.parent().get().email)
        if self.get_crrt_user().email() != sub.talk.parent().get().email:
            # not crrent users submission
            is_submitter = False
            if not crrt_conf.user_rights().has_decision_rights(
                    self.get_crrt_user().email()):
                # and currt user does not have decision rights
                readonly = "readonly"
                disabled = "disabled"
            else:
                change_authority = True

        conf_questions = confquestion.retrieve_questions(crrt_conf.key)
        conf_answers = submission_ans.retrieve_answer_map(
            sub_key, map(lambda q: q.key, conf_questions))

        return {
            "talk_key":
            sub.talk,
            "talk":
            sub.talk.get(),
            "submitter":
            sub.talk.parent().get().name + " (" +
            sub.talk.parent().get().email + ")",
            "sub_key":
            sub_key,
            "sub_key_safe":
            sub_key.urlsafe(),
            "available_conferences":
            None,
            "crrt_conf":
            crrt_conf,
            "selected_track":
            sub.track,
            "selected_duration":
            sub.duration,
            "selected_format":
            sub.delivery_format,
            "selected_expenses":
            sub.expenses,
            "reviews":
            reviews,
            "review_count":
            len(reviews),
            "withdrawn":
            sub.is_withdrawn(),
            "agree_privacy":
            sub.gdpr_agreed,
            "privacy_agreement_lock":
            "disabled",
            "cospeakers":
            cospeak,
            "cospeakers_count":
            len(cospeak),
            "submissions_count":
            submission_queries.count_submissions(sub_key.parent(),
                                                 sub.talk.parent()),
            "readonly":
            readonly,
            "disabled":
            disabled,
            "change_authority":
            change_authority,
            "is_submitter":
            is_submitter,
            "conf_questions":
            conf_questions,
            "conf_answers":
            conf_answers,
            "created":
            sub.created,
        }
コード例 #10
0
    def get(self):
        submission_key = ndb.Key(urlsafe=self.request.get("sub"))
        submission = submission_key.get()

        conference = submission_key.parent().get()

        user = self.get_crrt_user().email()
        existing_vote = voterecord.find_existing_vote_by_reviewer(
            submission_key, user, round=1)

        if existing_vote is not None:
            vote_safe_key = existing_vote.key.urlsafe()
            existing_score = existing_vote.score
            existing_comment = existing_vote.comment
            private_comment = votecomment.retrieve_comment_text(
                existing_vote.key)
        else:
            vote_safe_key = ""
            existing_score = 1
            existing_comment = ""
            private_comment = ""

        conf_questions = confquestion.retrieve_questions(conference.key)
        conf_answers = self.conference_answers(conf_questions, submission_key)

        newscoringconfig = confreviewconfig.get_conference_review_factory(conference.key). \
            get_round_config(int(self.request.get("round")))

        speakers = {}
        if newscoringconfig.is_speaker_named():
            show_name = True
            speakers = self.retrieve_speakers(submission)
        else:
            show_name = False

        template_values = {
            "speakers":
            speakers,
            "readonly":
            "readonly",
            "talk_details":
            submission.talk.get(),
            "submissionrecord_track":
            conference.track_options()[submission.track],
            "submissionrecord_duration":
            conference.duration_options()[submission.duration],
            "submissionrecord_format":
            conference.delivery_format_options()[submission.delivery_format],
            "submissionrecord_expenses":
            conference.expenses_options()[submission.expense_expectations],
            "submissionrecord_key":
            submission_key.urlsafe(),
            "voterecord":
            vote_safe_key,
            "existing_score":
            existing_score,
            "existing_comment":
            existing_comment,
            "private_comment":
            private_comment,
            "emaillocked":
            "disabled",
            "submission":
            submission,
            "conf_questions":
            conf_questions,
            "conf_answers":
            conf_answers,
            "newscoringconfig":
            newscoringconfig,
            "show_name":
            show_name,
        }

        self.write_page('subreview_lib/newscoringpage.html', template_values)
コード例 #11
0
def read_and_store_conference_questions(handler, subs_key):
    crrt_conference = subs_key.parent()
    conf_questions = confquestion.retrieve_questions(crrt_conference)
    for q in conf_questions:
        text_answer = handler.request.get(q.shortname())
        submission_ans.make_or_update(subs_key, q.key, text_answer)