Skip to content

Commit

Permalink
Fix description extension, enable transform species in development
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikn-artsdatabanken committed Feb 7, 2024
1 parent 6727e52 commit de3c36a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Assessments.Frontend.Web/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"TransformAssessments": true
},
"Species2021": {
"TransformAssessments": false
"TransformAssessments": true
}
}
}
7 changes: 7 additions & 0 deletions Assessments.Shared/Helpers/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ private static T GetAttribute<T>(this Enum value) where T : Attribute
public static string Description(this Enum value)
{
var attribute = value.GetAttribute<DisplayAttribute>();

if (attribute == null)
{
var descriptionAttribute = value.GetAttribute<DescriptionAttribute>();
return descriptionAttribute == null ? value.ToString() : descriptionAttribute.Description;
}

switch (attribute)
{
case { ResourceType: not null, Description: not null }:
Expand Down

0 comments on commit de3c36a

Please sign in to comment.