Performs an update of a new instance count for the current file. The self.file.count_instances is a cached value that represents the number of instances in the file that have not been deleted (soft_delete=True).. @:param action_type: 'new_instance', 'del
(self, action_type = None)
| 1655 | self.file.count_instances += 1 |
| 1656 | |
| 1657 | def update_instance_count(self, action_type = None): |
| 1658 | """ |
| 1659 | Performs an update of a new instance count for the current file. |
| 1660 | The self.file.count_instances is a cached value that represents |
| 1661 | the number of instances in the file that have not been deleted (soft_delete=True).. |
| 1662 | @:param action_type: 'new_instance', 'deleted_instance' |
| 1663 | :return: |
| 1664 | """ |
| 1665 | if self.file is None: |
| 1666 | return |
| 1667 | |
| 1668 | if self.file.count_instances is None: # just in case, should not be needed |
| 1669 | self.file.count_instances = 0 |
| 1670 | |
| 1671 | if action_type == 'new_instance': |
| 1672 | self.file.count_instances += 1 |
| 1673 | |
| 1674 | elif action_type == 'delete_instance': |
| 1675 | self.file.count_instances -= 1 |
| 1676 | # Add this case to prevent having negative counts. |
| 1677 | if self.file.count_instances < 0: |
| 1678 | self.file.count_instances = 0 |
| 1679 | |
| 1680 | def may_create_new_file_old_source_control(self): |
| 1681 |
no outgoing calls
no test coverage detected