Skip to content

Commit

Permalink
check for duplicate feature
Browse files Browse the repository at this point in the history
  • Loading branch information
RudiThoeni committed Jan 24, 2025
1 parent 9a527c0 commit 632cc1c
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions OdhApiImporter/Helpers/RAVEN/LtsApiv2Operations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,15 @@ QueryFactory queryFactory
{
if(accommodation.Features.Where(x => x.Id == "8192350ABF6B41DA89B255B340003991").Count() > 0)
{
var featuretoremove = accommodation.Features.Where(x => x.Id == "8192350ABF6B41DA89B255B340003991").FirstOrDefault();
if(featuretoremove != null)
accommodation.Features.Remove(featuretoremove);
var featurestoremove = accommodation.Features.Where(x => x.Id == "8192350ABF6B41DA89B255B340003991").ToList();
if(featurestoremove != null)
{
foreach(var featuretoremove in featurestoremove)
{
accommodation.Features.Remove(featuretoremove);
}
}

}
}

Expand All @@ -280,7 +286,22 @@ QueryFactory queryFactory
//Update also the Features
if (accommodation.Features == null)
accommodation.Features = new List<AccoFeatureLinked>();
accommodation.Features.Add(guestcardfeature);
if(accommodation.Features.Count() == 0)
{
accommodation.Features.Add(guestcardfeature);
}
else
{
if (accommodation.Features.Where(x => x.Id == "8192350ABF6B41DA89B255B340003991").Count() == 0)
accommodation.Features.Add(guestcardfeature);
else if (accommodation.Features.Where(x => x.Id == "8192350ABF6B41DA89B255B340003991").Count() == 2)
{
//Clear Duplicates
var featuretoremove = accommodation.Features.Where(x => x.Id == "8192350ABF6B41DA89B255B340003991").FirstOrDefault();
accommodation.Features.Remove(featuretoremove);
}
}

}

//Compatiblity features to Tags
Expand Down

0 comments on commit 632cc1c

Please sign in to comment.