-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add geo search filtering for alle-type datasets (#9)
- Loading branch information
1 parent
c0e46b4
commit 22d85ef
Showing
6 changed files
with
122 additions
and
53 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/Dan.Plugin.Tilda/Extensions/BrEntityRegisterEntryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Dan.Plugin.Tilda.Models; | ||
|
||
namespace Dan.Plugin.Tilda.Extensions; | ||
|
||
public static class BrEntityRegisterEntryExtensions | ||
{ | ||
public static bool MatchesFilterParameters(this BREntityRegisterEntry brEntity, TildaParameters tildaParameters) | ||
{ | ||
// No params; nothing to filter on | ||
if (tildaParameters == null) | ||
{ | ||
return true; | ||
} | ||
|
||
if (tildaParameters.postcode != null && brEntity.Postadresse?.Postnummer != tildaParameters.postcode) | ||
{ | ||
return false; | ||
} | ||
|
||
if (tildaParameters.municipalityNumber != null && | ||
brEntity.Postadresse?.Kommunenummer != tildaParameters.municipalityNumber) | ||
{ | ||
return false; | ||
} | ||
|
||
if (tildaParameters.nace != null && | ||
(brEntity.Naeringskode1?.Kode != tildaParameters.nace || | ||
brEntity.Naeringskode2?.Kode != tildaParameters.nace || | ||
brEntity.Naeringskode3?.Kode != tildaParameters.nace)) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters