Пример #1
0
    def allowed_to_forward(self, adherence_case):
        allowed_case_types_and_users = (
            self._allowed_case_type(adherence_case) and self._allowed_user(adherence_case)
        )
        if not allowed_case_types_and_users:
            return False

        try:
            episode_case = get_episode_case_from_adherence(adherence_case.domain, adherence_case.case_id)
            if episode_case.closed:
                return False
        except ENikshayCaseNotFound:
            return False

        episode_case_properties = episode_case.dynamic_case_properties()
        adherence_case_properties = adherence_case.dynamic_case_properties()

        enabled = episode_case_properties.get('dots_99_enabled') == 'true'
        registered = episode_case_properties.get('dots_99_registered') == 'true'
        from_enikshay = adherence_case_properties.get('adherence_source') == 'enikshay'
        previously_updated = adherence_case_properties.get('dots_99_updated') == 'true'
        return (
            enabled
            and registered
            and from_enikshay
            and not previously_updated
            and case_was_created(adherence_case)
            and is_valid_episode_submission(episode_case)
        )
Пример #2
0
 def allowed_to_forward(self, person_case):
     return (person_case.type == CASE_TYPE_PERSON
             and person_case.get_case_property(ENROLLED_IN_PRIVATE) == 'true'
             and person_case.get_case_property('current_episode_type') == 'confirmed_tb'
             and is_valid_person_submission(person_case)
             and (case_was_created(person_case)
                  or case_properties_changed(person_case, self.properties_we_care_about)))