Revize a49028dd
Přidáno uživatelem Vojtěch Bartička před téměř 3 roky(ů)
Backend/Core/Services/AnnotationService/AnnotationServiceEF.cs | ||
---|---|---|
77 | 77 |
|
78 | 78 |
public AnnotationListResponse GetUserAnnotations(Guid userId) |
79 | 79 |
{ |
80 |
var annotations = context.Annotations.Where(a => a.User.Id == userId).Include(a => a.Document).ToList(); |
|
81 |
var documentIds = annotations.Select(a => a.Document.Id).ToList(); |
|
82 |
var documents = context.Documents.Where(d => documentIds.Contains(d.Id)); |
|
80 |
var annotations = context.Annotations |
|
81 |
.Where(a => a.User.Id == userId) |
|
82 |
.Include(a => a.Document) |
|
83 |
.ToList(); |
|
83 | 84 |
var infos = new List<AnnotationListInfo>(); |
84 |
|
|
85 |
var annotationsDocuments = annotations.Zip(documents, (a, d) => new { Annotation = a, Document = d }); |
|
86 |
foreach (var ad in annotationsDocuments) |
|
85 |
foreach (var annotation in annotations) |
|
87 | 86 |
{ |
88 | 87 |
infos.Add(new AnnotationListInfo() |
89 | 88 |
{ |
90 |
AnnotationId = ad.Annotation.Id,
|
|
91 |
DocumentName = ad.Document.Name,
|
|
92 |
State = ad.Annotation.State
|
|
89 |
AnnotationId = annotation.Id, |
|
90 |
DocumentName = annotation.Document.Name,
|
|
91 |
State = annotation.State |
|
93 | 92 |
}); |
94 | 93 |
} |
95 | 94 |
|
Také k dispozici: Unified diff
Fixed issue with annotations not matching documents