Skip to content

Conversation

sudip-khanal
Copy link
Contributor

@sudip-khanal sudip-khanal commented Sep 11, 2025

Addresses

Changes

  • Update dref status
  • Migrate old status to new
  • Add status check on publish api

Checklist

Things that should succeed before merging.

  • Updated/ran unit tests
  • Updated CHANGELOG.md

Release

If there is a version update, make sure to tag the repository with the latest version.

@sudip-khanal sudip-khanal requested review from susilnem, szabozoltan69 and frozenhelium and removed request for susilnem and szabozoltan69 September 12, 2025 03:41
)
def get_published(self, request, pk=None, version=None):
dref = self.get_object()
if dref.status != Dref.Status.FINALIZED:
Copy link
Member

@susilnem susilnem Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add validation in serializer to enforce allowed status transitions for post and update. It's fine for publish api.

Draft-> FINALIZED.
FINALIZED-> draft
FINALIZED -> Approved


def get_unpublished_op_update_count(self, obj) -> int:
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, is_published=False).count()
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, status=Dref.Status.DRAFT).count()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, status=Dref.Status.DRAFT).count()
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, status!=Dref.Status.APPROVED).count()


def get_unpublished_final_report_count(self, obj) -> int:
return DrefFinalReport.objects.filter(dref_id=obj.id, is_published=False).count()
return DrefFinalReport.objects.filter(dref_id=obj.id, status=Dref.Status.DRAFT).count()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

@sudip-khanal sudip-khanal force-pushed the feat/update-dref-status branch 2 times, most recently from 89a6cb8 to 7bebad0 Compare September 26, 2025 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants