Ejemplo n.º 1
0
    def test_delete_cospeakers(self):
        t = talk.Talk(parent=self.spk1.key)
        t.title = "Talk talk"
        t.put()
        sub_key1 = submissionrecord.make_submission(t.key, self.c.key, "TrackB", "format")
        cospeak = cospeaker.make_cospeaker(sub_key1, "Harry", "*****@*****.**")
        cospeak2 = cospeaker.make_cospeaker(sub_key1, "Ron", "*****@*****.**")
        self.assertEquals(len(cospeaker.get_cospeakers(sub_key1)), 2)

        cospeaker.delete_cospeakers(sub_key1)
        self.assertEquals(len(cospeaker.get_cospeakers(sub_key1)), 0)
Ejemplo n.º 2
0
    def retrieve_speakers(self, submission):
        speakers = [submission.talk.parent().get()]
        cospeakers = cospeaker.get_cospeakers(submission.key)

        for cospeak in cospeakers:
            speakers = speakers + [cospeak.profile()]
        return speakers
Ejemplo n.º 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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
    def test_profile_exists(self):
        t = talk.Talk(parent=self.spk1.key)
        t.title = "Talk talk"
        t.put()
        sub_key1 = submissionrecord.make_submission(t.key, self.c.key, "TrackB", "format")

        self.assertEquals(len(cospeaker.get_cospeakers(sub_key1)), 0)

        cospeak = cospeaker.make_cospeaker(sub_key1, "Harry", "*****@*****.**")
        r = cospeaker.get_cospeakers(sub_key1)
        self.assertEquals(len(r), 1)
        self.assertEquals(r[0], cospeak)

        self.assertFalse(r[0].profile_exists())
        self.assertFalse(speaker.speaker_exists("*****@*****.**"))
        harry = speaker.make_new_speaker("*****@*****.**")
        harry.put()
        self.assertTrue(speaker.speaker_exists("*****@*****.**"))
        self.assertTrue(r[0].profile_exists())
Ejemplo n.º 6
0
    def get(self):
        # remove the session flag that tells us this was a single page submit login
        self.session.pop("singlesubmit", 0)

        conf_key = ndb.Key(urlsafe=self.request.get("conf"))
        sub_key = ndb.Key(urlsafe=self.request.get("sub"))
        template_values = {
            'conference': conf_key.get(),
            'sub': sub_key.get(),
            'cospeakers': cospeaker.get_cospeakers(sub_key),
        }

        self.write_page('submission_lib/subm_thanks.html', template_values)
Ejemplo n.º 7
0
    def test_delete_conference(self):
        conf1_key, sub1_key = self.mk_test_data("WorldConf 1000")
        conf2_key, sub2_key = self.mk_test_data("WorldConf 2000")

        self.assertEquals(
            1,
            len(submissionrecord.retrieve_conference_submissions(conf1_key)))
        self.assertEquals(
            1,
            len(submissionrecord.retrieve_conference_submissions(conf2_key)))
        self.assertEquals(1, len(voterecord.find_existing_votes(sub1_key, 1)))
        self.assertEquals(1, len(voterecord.find_existing_votes(sub2_key, 1)))
        self.assertEquals(1, len(cospeaker.get_cospeakers(sub1_key)))
        self.assertEquals(1, len(cospeaker.get_cospeakers(sub2_key)))
        self.assertEquals(2, confoptions.get_next_counter(conf1_key))
        self.assertEquals(2, confoptions.get_next_counter(conf2_key))
        self.assertEquals(6, len(ndb.Query(ancestor=conf1_key).fetch()))
        self.assertEquals(6, len(ndb.Query(ancestor=conf2_key).fetch()))

        confdb.delete_conference(conf2_key)
        self.assertEquals(None, conf2_key.get())

        self.assertEquals(
            1,
            len(submissionrecord.retrieve_conference_submissions(conf1_key)))
        self.assertEquals(
            0,
            len(submissionrecord.retrieve_conference_submissions(conf2_key)))
        self.assertEquals(1, len(voterecord.find_existing_votes(sub1_key, 1)))
        self.assertEquals(None, voterecord.find_existing_votes(sub2_key, 1))
        self.assertEquals(1, len(cospeaker.get_cospeakers(sub1_key)))
        self.assertEquals(0, len(cospeaker.get_cospeakers(sub2_key)))
        self.assertEquals(3, confoptions.get_next_counter(conf1_key))

        self.assertEquals(0, len(ndb.Query(ancestor=conf2_key).fetch()))
        self.assertEquals(None, conf2_key.get())
        self.assertEquals(None, confdb.get_conf_by_name("WorldConf 2000"))
Ejemplo n.º 8
0
def write_sub(out, sub):
    write_with_comma(out, sub.final_decision())
    write_with_comma(out, sub.submitter())
    speaker = sub.talk.parent().get()
    write_with_comma(out, speaker.email)
    write_with_comma(out, speaker.telephone)
    write_with_comma(out, speaker.address)

    cospeaks = cospeaker.get_cospeakers(sub.key)
    for co in range(0, 2):
        if co < len(cospeaks):
            write_with_comma(out, cospeaks[co].name)
        else:
            write_with_comma(out, "")

    write_with_comma(out, speaker.field(speaker.FIELD_AFFILICATION))
    write_with_comma(out, speaker.field(speaker.FIELD_TWITTER))
    write_with_comma(out, speaker.bio)

    # Field for URL to speaker photo
    if speaker.fullsize_picture == None:
        write_with_comma(out, "None")
    else:
        write_with_comma(
            out,
            sysinfo.home_url() + "/speakerfullimg?img_id=" +
            speaker.key.urlsafe())

    tlk = sub.talk.get()
    write_with_comma(out, tlk.title)
    write_with_comma(out, tlk.field(talk.SHORT_SYNOPSIS))
    write_with_comma(out, tlk.field(talk.LONG_SYNOPSIS))

    conf = sub.key.parent().get()
    write_with_comma(out, conf.track_options()[sub.track_name])
    write_with_comma(out,
                     conf.delivery_format_options()[sub.delivery_format_text])
    write_with_comma(out, conf.duration_options()[sub.duration])
    write_with_comma(out, conf.expenses_options()[sub.expense_expectations])
Ejemplo n.º 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,
        }