Skip to content

Commit

Permalink
Merge pull request #363 from claushaas/dev
Browse files Browse the repository at this point in the history
sort tags
  • Loading branch information
claushaas authored Sep 10, 2024
2 parents e07ad83 + 51326bf commit 926598e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/services/tag.service.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ export class TagService {
const tags = [];

for (const tag of parsedTags) {
const tagIndex = tags.findIndex(({tagOption, tagValues}) => tagOption === tag.tagOption);
const tagIndex = tags.findIndex(({tagOption}) => tagOption === tag.tagOption);

if (tagIndex === -1) {
tags.push({tagOption: tag.tagOption, tagValues: [tag.tagValue]});
} else if (!tags[tagIndex].tagValues.includes(tag.tagValue)) {
tags[tagIndex].tagValues.push(tag.tagValue);
}

tags[tagIndex].tagValues.sort((a, b) => a.localeCompare(b));
}

return {
Expand Down

0 comments on commit 926598e

Please sign in to comment.