< Summary - Syki

Information
Class: Syki.Back.Features.Academic.GetNotifications.GetNotificationsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/GetNotifications/GetNotificationsService.cs
Tag: 4_16869239191
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
 43public class GetNotificationsService(SykiDbContext ctx) : IAcademicService
 4{
 5    public async Task<List<NotificationOut>> Get(Guid institutionId)
 6    {
 47        var notifications = await ctx.Notifications.AsNoTracking()
 48            .Include(x => x.Users)
 49            .Where(c => c.InstitutionId == institutionId)
 410            .OrderByDescending(x => x.CreatedAt)
 411            .ToListAsync();
 12
 413        notifications.ForEach(n =>
 414        {
 415            var viewed = n.Users.Count(u => u.ViewedAt != null);
 416            var total = n.Users.Count;
 417            n.Views = $"{viewed}/{total}";
 818        });
 19
 820        return notifications.ConvertAll(p => p.ToOut());
 421    }
 22}