Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,10 +1606,26 @@ class Meta:
)


class EventDetailsSerializer(ModelSerializer):
ifrc_severity_level_display = serializers.CharField(source="get_ifrc_severity_level_display", read_only=True)

class Meta:
model = Event
fields = (
"id",
"name",
"ifrc_severity_level",
"ifrc_severity_level_display",
"ifrc_severity_level_update_date",
"updated_at",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you verify if this is the field actually used to track the severity changes? or if incase we need this??

ifrc_severity_level_update_date

ifrc_severity_level_update_date = models.DateTimeField(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need to take this from the other model used to save history.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ifrc_severity_level_update_date field tracks the date when the severity level changes. We don’t need this information for now, but I’ve added the field in the event details as it may be useful in the future.

)


class AppealHistorySerializer(ModelSerializer):
country = MiniCountrySerializer(read_only=True)
dtype = DisasterTypeSerializer(read_only=True)
region = RegionSerializer(read_only=True)
event_details = EventDetailsSerializer(source="appeal.event", read_only=True)
atype_display = serializers.CharField(source="get_atype_display", read_only=True)
status_display = serializers.CharField(source="get_status_display", read_only=True)
code = serializers.CharField(source="appeal.code", read_only=True)
Expand Down Expand Up @@ -1646,6 +1662,7 @@ class Meta:
"country",
"region",
"id",
"event_details",
)


Expand Down
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 1 files
+43 −0 openapi-schema.yaml
Loading