Determines and sets the deletion_type to user if the previouse instance was not deleted and new version is. This is assumed to be a helper function of the main algorithm and is not intended for use outside this class. Main assumption is that we know t
(self, instance, is_new_instance)
| 1936 | return is_new_instance |
| 1937 | |
| 1938 | def __validate_user_deletion(self, instance, is_new_instance): |
| 1939 | """ |
| 1940 | Determines and sets the deletion_type to user if the previouse instance was not deleted |
| 1941 | and new version is. |
| 1942 | This is assumed to be a helper function of the main algorithm and is not intended for use |
| 1943 | outside this class. Main assumption is that we know the system deletion has not happened yet |
| 1944 | at this point so we know that the soft_delete current value was provided by the client and |
| 1945 | not set by the system (which happens at a next step.) |
| 1946 | :param instance: |
| 1947 | :return: |
| 1948 | """ |
| 1949 | if not self.do_init_existing_instances: |
| 1950 | return instance |
| 1951 | # Here we want to determine if the instance was deleted by the user or not by checking the previous ID |
| 1952 | if instance.previous_id is not None: |
| 1953 | previous_instance = self.instance_list_existing_dict.get(self.instance.previous_id) |
| 1954 | if not previous_instance: |
| 1955 | return instance |
| 1956 | |
| 1957 | if previous_instance.soft_delete is False and instance.soft_delete is True: |
| 1958 | previous_instance.deletion_type = 'user' |
| 1959 | self.instance.action_type = 'deleted' |
| 1960 | self.session.add(previous_instance) |
| 1961 | self.session.add(self.instance) |
| 1962 | |
| 1963 | if previous_instance.soft_delete is True and instance.soft_delete is False and is_new_instance: |
| 1964 | self.instance.action_type = 'undeleted' |
| 1965 | self.session.add(previous_instance) |
| 1966 | self.session.add(self.instance) |
| 1967 | return instance |
| 1968 | |
| 1969 | def task_update(self): |
| 1970 | """ |
no test coverage detected