Exemplo n.º 1
0
    def set_evaluation_result(self, evaluation_response, author = None, admin = None, date = datetime.utcnow().date()):
        """
        Sets the :py:attr:_evaluation_result to :py:const:EVALUATION_TRUE if the :py:attr:review_request_1 is
        :py:const:RESPONSE_TRUE and the :py:attr:review_request_2 is :py:const:RESPONSE_TRUE and to
        to :py:const:EVALUATION_FALSE if one of the review request is to :py:const:RESPONSE_FALSE.

        :param evaluation_response: The response of the :py:class:Review object.
        :param author: The author(s) (:py:class:User) of the :py:class:Document and the requester of the
        :py:class:Review object, the default value is None.
        :param admin: The admin(s) (:py:class:User) of the :py:class:Project and the administrator(s) of the
        :py:class:Review object, the default value is None.
        :param date: The :py:class:Review object's date, the default value is datetime.utcnow().date().
        :exception ValueError if the evaluation response is not valid, because of various reasons.
        :return:
        """
        if self.review_response_1 in [RESPONSE_TRUE, RESPONSE_FALSE] and \
                        self.review_response_2 in [RESPONSE_TRUE, RESPONSE_FALSE]:
            if self.review_request_1 == RESPONSE_TRUE and self.review_request_2 == RESPONSE_TRUE:
                self._evaluation_result = EVALUATION_TRUE
            else:
                self._evaluation_result = EVALUATION_FALSE
            if author and admin:
                save_message(author, admin, date, evaluation_response)
        else:
            raise ValueError("Review response can't be set until a review is not sent!")
Exemplo n.º 2
0
    def set_review_request_2(self, review_request_nessage, author = None, admin = None,
                             date = datetime.utcnow().date()):
        """
        Sets the :py:attr:_review_request_2 to SENT.

        :param review_request_nessage: The message of the :py:class:Review object.
        :param author: The author(s) (:py:class:User) of the :py:class:Document and the requester of the
        :py:class:Review object, the default value is None.
        :param admin: The admin(s) (:py:class:User) of the :py:class:Project and the administrator(s) of the
        :py:class:Review object, the default value is None.
        :param date: The :py:class:Review object's date, the default value is datetime.utcnow().date().
        :exception ValueError if the review request is not valid, because of various reasons.
        :return:
        """
        if self.submission == SENT and self.review_request_2 == NOT_SENT and self.review_request_1 == SENT:
            self._review_request_2 = SENT
            if author and admin:
                save_message(author, admin, date, review_request_nessage)
        else:
            raise ValueError("Review request can't be sent until a submission is not placed!")
Exemplo n.º 3
0
    def set_review_response_1(self, review_response, author = None, admin = None, date = datetime.utcnow().date()):
        """
        Sets the :py:attr:_review_response_1 to :py:const:RESPONSE_TRUE if the ``review_response`` is TRUE and
        to :py:const:RESPONSE_FALSE if the ``review_response`` is FALSE.

        :param review_response: The response of the :py:class:Review object.
        :param author: The author(s) (:py:class:User) of the :py:class:Document and the requester of the
        :py:class:Review object, the default value is None.
        :param admin: The admin(s) (:py:class:User) of the :py:class:Project and the administrator(s) of the
        :py:class:Review object, the default value is None.
        :param date: The :py:class:Review object's date, the default value is datetime.utcnow().date().
        :exception ValueError if the review response is not valid, because of various reasons.
        :return:
        """
        if self.review_request_1 == SENT and self.review_request_2 == SENT:
            if review_response:
                self._review_response_1 = RESPONSE_TRUE
            else:
                self._review_response_1 = RESPONSE_FALSE
            if author and admin:
                save_message(author, admin, date, review_response)
        else:
            raise ValueError("Review response can't be set until a review is not sent!")