Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into E2E-Playwright-Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DamiLaleye1 committed Nov 1, 2024
2 parents 3d829d3 + 01a6855 commit 20ef1bd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
1 change: 1 addition & 0 deletions local/db/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version: '3.8'
name: 'family-hubs'
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AutoMapper;
using AutoMapper.QueryableExtensions;
using FamilyHubs.ServiceDirectory.Data.Entities;
using FamilyHubs.ServiceDirectory.Data.Repository;
using FamilyHubs.ServiceDirectory.Shared.Dto;
using FamilyHubs.ServiceDirectory.Shared.Enums;
Expand Down Expand Up @@ -52,17 +53,7 @@ private async Task<List<ServiceNameDto>> GetServiceNames(GetServiceNamesCommand
int skip = (request.PageNumber - 1) * request.PageSize;

//todo: do we need _context.ServiceNames?
var servicesQuery = _context.Services
.Where(s => s.Status != ServiceStatusType.Defunct);

if (request.OrganisationId != null)
{
servicesQuery = servicesQuery.Where(s => s.OrganisationId == request.OrganisationId);
}
if (!string.IsNullOrEmpty(request.ServiceNameSearch))
{
servicesQuery = servicesQuery.Where(s => s.Name.Contains(request.ServiceNameSearch));
}
var servicesQuery = GetBaseQuery(request);

servicesQuery = request.Order == SortOrder.ascending
? servicesQuery.OrderBy(s => s.Name)
Expand All @@ -78,18 +69,25 @@ private async Task<List<ServiceNameDto>> GetServiceNames(GetServiceNamesCommand

private async Task<int> GetServicesCount(GetServiceNamesCommand request, CancellationToken cancellationToken)
{
var serviceCountQuery = _context.Services
.Where(s => s.Status != ServiceStatusType.Deleted);
var serviceCountQuery = GetBaseQuery(request);

if (request.OrganisationId != null)
return await serviceCountQuery.CountAsync(cancellationToken);
}

private IQueryable<Service> GetBaseQuery(GetServiceNamesCommand cmd)
{
var query = _context.Services
.Where(s => s.Status != ServiceStatusType.Defunct);

if (cmd.OrganisationId != null)
{
serviceCountQuery = serviceCountQuery.Where(s => s.OrganisationId == request.OrganisationId);
query = query.Where(s => s.OrganisationId == cmd.OrganisationId);
}
if (!string.IsNullOrEmpty(request.ServiceNameSearch))
if (!string.IsNullOrEmpty(cmd.ServiceNameSearch))
{
serviceCountQuery = serviceCountQuery.Where(s => s.Name.Contains(request.ServiceNameSearch));
query = query.Where(s => s.Name.Contains(cmd.ServiceNameSearch));
}

return await serviceCountQuery.CountAsync(cancellationToken);
return query;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<h1 class="govuk-label--l">
Is there anything else people need to know about this location?
</h1>
<p>This could include:</p>
<p>You must only include information about this location. For example:</p>
<ul class="govuk-list govuk-list--bullet">
<li>contact information</li>
<li>opening times</li>
<li>opening times for the building</li>
<li>if the building is wheelchair accessible</li>
<li>how to access the location</li>
</ul>
<li>how to access the building</li>
</ul>

0 comments on commit 20ef1bd

Please sign in to comment.