Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 8c9ce202

Přidáno uživatelem Vojtěch Bartička před asi 2 roky(ů)

Fixed issues with database OR mapping

Zobrazit rozdíly:

Backend/Core/Services/DocumentService/DocumentServiceEF.cs
137 137
            List<DocumentListInfo> documentInfos = new List<DocumentListInfo>();
138 138
            foreach (var document in documents.GetRange(firstIndex, pageSize))
139 139
            {
140
                var annotatingUsers = databaseContext.Annotations.Where(a => a.Document == document).Select(a => a.User).ToList();
140
                var annotatingUsers = databaseContext.Annotations
141
                    .Where(a => !(a is FinalAnnotation))
142
                    .Where(a => a.Document == document)
143
                    .Select(a => a.User).ToList();
144

  
141 145
                List<DocumentUserInfo> annotatingUsersDto = new();
142 146

  
143 147
                // Include annotation state
144 148
                foreach (var annotatingUser in annotatingUsers)
145 149
                {
146 150
                    var annotation = databaseContext.Annotations
151
                        .Where(a => !(a is FinalAnnotation))
147 152
                        .Include(a => a.Document)
148
                        .Single(a => a.Document == document && a.User == annotatingUser);
153
                        .Single(a => a.Document == document && a.User == annotatingUser && !(a is FinalAnnotation));
149 154
                    var dui = mapper.Map<DocumentUserInfo>(annotatingUser);
150 155
                    dui.State = annotation.State;
151 156
                    annotatingUsersDto.Add(dui);

Také k dispozici: Unified diff