Skip to content

Commit

Permalink
Merge pull request #1390 from Artsdatabanken/feature/translateEnumsPa…
Browse files Browse the repository at this point in the history
…rtTwo

Feature/translate enums part two
  • Loading branch information
matssa authored Mar 4, 2024
2 parents a0f012b + 33a81f3 commit e0dd561
Show file tree
Hide file tree
Showing 30 changed files with 2,198 additions and 465 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public async Task<IActionResult> Suggestion([FromQuery] string search)
area = x.EvaluationContext,
category = x.Category,
speciesGroup = x.SpeciesGroup,
speciesGroupIconUrl = AlienSpeciesHelpers.GetSpeciesGroup(SpeciesGroups.AlienSpecies2023SpeciesGroups.Filters, x.SpeciesGroup).ImageUrl,
speciesGroupIconUrl = AlienSpeciesHelpers.GetSpeciesGroup(x.SpeciesGroup.DisplayName()).ImageUrl,
scientificName = x.ScientificName.ScientificName
})
.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ namespace Assessments.Frontend.Web.Infrastructure.AlienSpecies
{
public class AlienSpeciesHelpers
{
public static FilterItem GetSpeciesGroup(FilterItem[] speciesGroups, string speciesGroupName)
public static FilterItem GetSpeciesGroup(string speciesGroupName)
{
foreach (var speciesGroup in speciesGroups)
var speciesGroups = new SpeciesGroups().AlienSpecies2023SpeciesGroups();
foreach (var speciesGroup in speciesGroups.Filters)
{
if (speciesGroup.Name == speciesGroupName)
{
Expand All @@ -33,32 +34,6 @@ public static FilterItem GetSpeciesGroup(FilterItem[] speciesGroups, string spec
return null;
}

public static string GetSpeciesGroupByShortName(string shortName)
{
var speciesGroups = SpeciesGroups.AlienSpecies2023SpeciesGroups.Filters;

foreach (var species in speciesGroups)
{
FilterItem speciesGroup = species;
if (speciesGroup.NameShort == shortName)
{
return speciesGroup.Name;
}

if (speciesGroup.SubGroup != null)
{
foreach (var subGroup in species.SubGroup.Filters)
{
if (subGroup.NameShort == shortName)
{
return subGroup.Name;
}
}
}
}
return string.Empty;
}

public static string CriteriaDescription(AlienSpeciesAssessment2023CriteriaLetter letter, int value)
{
var description = string.Empty;
Expand Down
Loading

0 comments on commit e0dd561

Please sign in to comment.