예제 #1
0
파일: main.py 프로젝트: psawaya/ERA
    def post(self,reviewID,nthScreen):        
        review = Review.get_by_id(int(reviewID))
        
        # First, unset all option flags for the prompt, and then
        # reset them as needed as we look at the options.

        # Only call review.put() at the end, so we only write
        # the flags to the DB once.
        
        # Look for the prompts in the POST args, their arg name is just the prompt.key().id()
        for promptID in self.request.arguments.get('prompts[]'):
            prompt = Prompt.get_by_id(int(promptID))
            review.unsetFlagsByPrompt(prompt)
            
            # If a promptID isn't present in POST args, its options must be.
            
            if promptID in self.request.arguments:
                # Look for an entity in the DB with the keyName promptID_reviewID.
                # Or, create one if it doesn't already exist

                response = PromptResponse.get_or_insert("%s_%s" % (promptID,reviewID))
                response.review = review
                response.assignValue(self.request.arguments[promptID][0],prompt)

        for optionID in self.request.arguments.get('options[]') or []:
            # Each option value is a form element named 'option+<option ID>'
            optionValue = self.request.arguments.get("option" + optionID) == ['on']
            
            option = Option.get_by_id(int(optionID))
            response = PromptResponse.get_or_insert("%s_%s" % (option.key().id(),reviewID))
            response.review = review
            response.assignValue(optionValue,None,option)
            
            for flag in option.flagsSet:
                review.setFlagForPromptOption(option,flag)

        review.put()

        return self.renderOrRedirectNextScreen(review,long(nthScreen)+1)
예제 #2
0
파일: config_db.py 프로젝트: psawaya/ERA
p4.setType("textarea")
s1.addPrompt(p4)

p5 = Prompt.new()
p5.setText("Summary")
p5.setType("textarea")
s1.addPrompt(p5)

s2 = Screen.new()

# Relevance

p6 = Prompt.new()
p6.setType("checkbox")
p6.setText("How close is this paper to the call for paper's core coverage?")
p6o1 = Option.new()
p6o1.setText("This paper is solely about an element in the core coverage")
p6o2 = Option.new()
p6o2.setText("This paper is mainly about one of the elements in the core coverage")
p6o3 = Option.new()
p6o3.setText("This paper is only tangentally related to the call for papers")
p6o4 = Option.new()
p6o4.setText("This paper doesn't discuss any of the element in the call for paper's coverage")
p6.addOptions([p6o1, p6o2, p6o3, p6o4])
s2.addPrompt(p6)

# Originality

s3 = Screen.new()

p7 = Prompt.new()