-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into wip-csv-creator
- Loading branch information
Showing
21 changed files
with
571 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 26 additions & 5 deletions
31
contentful/qa-visualiser/tests/test_generate_visualisations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/Dfe.PlanTech.Application/Questionnaire/Queries/GetRecommendationQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Dfe.PlanTech.Application.Core; | ||
using Dfe.PlanTech.Application.Exceptions; | ||
using Dfe.PlanTech.Application.Persistence.Interfaces; | ||
using Dfe.PlanTech.Application.Persistence.Models; | ||
using Dfe.PlanTech.Domain.Common; | ||
using Dfe.PlanTech.Domain.Questionnaire.Interfaces; | ||
using Dfe.PlanTech.Domain.Questionnaire.Models; | ||
|
||
namespace Dfe.PlanTech.Application.Questionnaire.Queries | ||
{ | ||
public class GetRecommendationQuery : ContentRetriever, IGetRecommendationQuery | ||
{ | ||
|
||
public GetRecommendationQuery(IContentRepository repository) : base(repository) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Returns recommendation chunks from contentful but only containing the system details ID and the header. | ||
/// </summary> | ||
public async Task<(IEnumerable<RecommendationChunk> Chunks, Pagination Pagination)> GetChunksByPage(int page, CancellationToken cancellationToken = default) | ||
{ | ||
try | ||
{ | ||
var totalEntries = await repository.GetEntitiesCount<RecommendationChunk>(cancellationToken); | ||
|
||
var options = new GetEntitiesOptions(include: 3) { Page = page }; | ||
var result = await repository.GetPaginatedEntities<RecommendationChunk>(options, cancellationToken); | ||
|
||
return (result, new Pagination() { Page = page, Total = totalEntries }); | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
throw new ContentfulDataUnavailableException("Error getting recommendation chunks from Contentful", ex); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Dfe.PlanTech.Domain.Common | ||
{ | ||
public class Pagination | ||
{ | ||
public int Total { get; set; } | ||
public int Page { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Dfe.PlanTech.Domain/Questionnaire/Interfaces/IGetRecommendationQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Dfe.PlanTech.Domain.Common; | ||
using Dfe.PlanTech.Domain.Questionnaire.Models; | ||
|
||
namespace Dfe.PlanTech.Domain.Questionnaire.Interfaces | ||
{ | ||
public interface IGetRecommendationQuery | ||
{ | ||
public Task<(IEnumerable<RecommendationChunk> Chunks, Pagination Pagination)> GetChunksByPage(int page, CancellationToken cancellationToken = default); | ||
|
||
} | ||
} |
Oops, something went wrong.