Skip to content

Commit

Permalink
Merge pull request #729 from NASA-IMPACT/728-remove-workflowstatushis…
Browse files Browse the repository at this point in the history
…tory-model-to-unblock-booz-allen

728 remove workflowstatushistory model to unblock booz allen
  • Loading branch information
code-geek authored May 15, 2024
2 parents cf3a8e5 + 102c0c4 commit 5ada840
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 119 deletions.
9 changes: 1 addition & 8 deletions sde_collections/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.http import HttpResponse

from .models.candidate_url import CandidateURL
from .models.collection import Collection, WorkflowStatusHistory
from .models.collection import Collection
from .models.pattern import IncludePattern, TitlePattern
from .tasks import import_candidate_urls_from_api

Expand Down Expand Up @@ -276,13 +276,6 @@ class TitlePatternAdmin(admin.ModelAdmin):
)


class WorkflowStatusHistoryAdmin(admin.ModelAdmin):
list_display = ("collection", "old_status", "new_status", "changed_at")
search_fields = ["collection__name"]
list_filter = ["new_status", "old_status"]


admin.site.register(WorkflowStatusHistory, WorkflowStatusHistoryAdmin)
admin.site.register(CandidateURL, CandidateURLAdmin)
admin.site.register(TitlePattern, TitlePatternAdmin)
admin.site.register(IncludePattern)
89 changes: 0 additions & 89 deletions sde_collections/migrations/0046_workflowstatushistory.py

This file was deleted.

22 changes: 0 additions & 22 deletions sde_collections/models/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,13 +467,6 @@ def save(self, *args, **kwargs):
details = STATUS_CHANGE_NOTIFICATIONS[transition]
message = format_slack_message(self.name, details, self.id)
send_slack_message(message)
if "workflow_status" in self.tracker.changed():
WorkflowStatusHistory.objects.create(
collection=self,
old_status=self.tracker.previous("workflow_status"),
new_status=self.workflow_status,
changed_by=self.curated_by,
)
# Call the parent class's save method
super().save(*args, **kwargs)

Expand Down Expand Up @@ -517,18 +510,3 @@ def create_configs_on_status_change(sender, instance, created, **kwargs):
instance.create_indexer_config(overwrite=False)
elif instance.workflow_status == WorkflowStatusChoices.READY_FOR_PUBLIC_PROD:
instance.add_to_public_query()


class WorkflowStatusHistory(models.Model):
collection = models.ForeignKey("Collection", on_delete=models.CASCADE, related_name="workflow_status_history")
old_status = models.IntegerField(choices=WorkflowStatusChoices.choices)
new_status = models.IntegerField(choices=WorkflowStatusChoices.choices)
changed_by = models.ForeignKey(get_user_model(), on_delete=models.SET_NULL, null=True, blank=True)
changed_at = models.DateTimeField(auto_now_add=True)

class Meta:
verbose_name = "Workflow Status History"
verbose_name_plural = "Workflow Status Histories"

def __str__(self):
return f"{self.collection.name} - {self.get_old_status_display()} to {self.get_new_status_display()}"

0 comments on commit 5ada840

Please sign in to comment.