< Summary

Information
Class: Syki.Back.Features.Academic.GetNotifications.GetNotificationsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/GetNotifications/GetNotificationsService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 22
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Get()100%11100%

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/GetNotifications/GetNotificationsService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.GetNotifications;
 2
 23public class GetNotificationsService(SykiDbContext ctx) : IAcademicService
 4{
 5    public async Task<List<NotificationOut>> Get(Guid institutionId)
 6    {
 27        var notifications = await ctx.Notifications.AsNoTracking()
 28            .Include(x => x.Users)
 29            .Where(c => c.InstitutionId == institutionId)
 210            .OrderByDescending(x => x.CreatedAt)
 211            .ToListAsync();
 12
 213        notifications.ForEach(n =>
 214        {
 215            var viewed = n.Users.Count(u => u.ViewedAt != null);
 216            var total = n.Users.Count;
 217            n.Views = $"{viewed}/{total}";
 418        });
 19
 420        return notifications.ConvertAll(p => p.ToOut());
 221    }
 22}