Revize 58363b44
Přidáno uživatelem Vojtěch Bartička před asi 2 roky(ů)
Backend/Core/Services/AnnotationService/AnnotationServiceEF.cs | ||
---|---|---|
683 | 683 |
|
684 | 684 |
parent.ChildNodes.Clear(); |
685 | 685 |
foreach (var child in newChildren) { parent.ChildNodes.Add(child); }*/ |
686 |
|
|
686 |
|
|
687 | 687 |
descendantsToEdit = docToEdit.DocumentNode.DescendantsAndSelf().ToList(); |
688 | 688 |
descendantsCount = descendantsToEdit.Count(); |
689 | 689 |
break; |
... | ... | |
743 | 743 |
{ |
744 | 744 |
annotationTag.Tag = context.Tags.Where(t => t.Id == request.Id).Single(); |
745 | 745 |
annotationTag.SubTag = null; |
746 |
|
|
747 |
// If for the same annotation exists a tag with same position and length and of the same type, ignore |
|
748 |
if (context.AnnotationTags.Any(at => |
|
749 |
at.Position == annotationTag.Position && |
|
750 |
at.Length == annotationTag.Length && |
|
751 |
at.Annotation == annotation && |
|
752 |
at.Tag == annotationTag.Tag)) |
|
753 |
{ |
|
754 |
throw new InvalidOperationException("Duplicate tag"); |
|
755 |
} |
|
756 |
|
|
746 | 757 |
} |
747 | 758 |
else if (request.Type == ETagType.SUBTAG) |
748 | 759 |
{ |
749 | 760 |
var subTag = context.SubTags.Where(st => st.Id == request.Id).Include(st => st.Tag).Single(); |
750 | 761 |
annotationTag.SubTag = subTag; |
751 | 762 |
annotationTag.Tag = subTag.Tag; |
763 |
|
|
764 |
if (context.AnnotationTags.Any(at => |
|
765 |
at.Position == annotationTag.Position && |
|
766 |
at.Length == annotationTag.Length && |
|
767 |
at.Annotation == annotation && |
|
768 |
at.Tag == annotationTag.Tag && |
|
769 |
at.SubTag == annotationTag.SubTag)) |
|
770 |
{ |
|
771 |
throw new InvalidOperationException("Duplicate tag"); |
|
772 |
} |
|
752 | 773 |
} |
753 | 774 |
else |
754 | 775 |
{ |
Také k dispozici: Unified diff
Backend checks for duplicate tags and returns bad request