Skip to content

Commit a836625

Browse files
committed
Taking care of it the tag does not exist.
1 parent dad579d commit a836625

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Helpers/BackendConfigurationAreaRulePlanningsServiceHelper.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,13 +1009,30 @@ await PairItemWithSiteHelper.Pair(
10091009

10101010
if (areaRule.Area.Type == AreaTypesEnum.Type3)
10111011
{
1012-
var tailbiteTag = await itemsPlanningPnDbContext.PlanningTags
1012+
var tailBiteTag = await itemsPlanningPnDbContext.PlanningTags
10131013
.FirstOrDefaultAsync(x => x.Name == "Halebid")
10141014
.ConfigureAwait(false);
10151015

1016-
if (tailbiteTag != null)
1016+
if (tailBiteTag != null)
10171017
{
1018-
planning.ReportGroupPlanningTagId = tailbiteTag.Id;
1018+
planning.ReportGroupPlanningTagId = tailBiteTag.Id;
1019+
if (tailBiteTag.WorkflowState == Constants.WorkflowStates.Removed)
1020+
{
1021+
tailBiteTag.WorkflowState = Constants.WorkflowStates.Created;
1022+
await tailBiteTag.Update(itemsPlanningPnDbContext)
1023+
.ConfigureAwait(false);
1024+
}
1025+
}
1026+
else // create tag
1027+
{
1028+
var newTag = new PlanningTag
1029+
{
1030+
Name = "Halebid",
1031+
CreatedByUserId = userId,
1032+
UpdatedByUserId = userId
1033+
};
1034+
await newTag.Create(itemsPlanningPnDbContext).ConfigureAwait(false);
1035+
planning.ReportGroupPlanningTagId = newTag.Id;
10191036
}
10201037
}
10211038

0 commit comments

Comments
 (0)