Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LearningHub.Nhs.WebUI/Configuration/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,6 @@ public Settings()
/// <summary>
/// Gets or sets the StatMandId.
/// </summary>
public int StatMandId { get; set; } = 12;
public int StatMandId { get; set; }
}
}
3 changes: 3 additions & 0 deletions LearningHub.Nhs.WebUI/Views/Reports/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@

</div>
</div>
<div class="nhsuk-grid-column-full nhsuk-u-padding-5">
@await Html.PartialAsync("_ReportHistoryPaging", Model)
</div>
</div>
</div>
</div>
76 changes: 76 additions & 0 deletions LearningHub.Nhs.WebUI/Views/Reports/_ReportHistoryPaging.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@using System.Web;
@using LearningHub.Nhs.WebUI.Models.Learning
@using LearningHub.Nhs.WebUI.Models.Search;
@model LearningHub.Nhs.WebUI.Models.Report.ReportHistoryViewModel


@{
var pagingModel = Model.ReportPaging;
var showPaging = pagingModel.CurrentPage >= 0 && pagingModel.CurrentPage <= pagingModel.TotalPages - 1;
var previousMessage = $"{pagingModel.CurrentPage} of {pagingModel.TotalPages}";
int CurrentPageNumber = pagingModel.CurrentPage + 1;
var nextMessage = string.Empty;
if (CurrentPageNumber <= pagingModel.TotalPages)
{
nextMessage = $"{CurrentPageNumber + 1} of {pagingModel.TotalPages}";
}
else
{
previousMessage = $"{CurrentPageNumber - 1} of {pagingModel.TotalPages}";
nextMessage = $"{CurrentPageNumber} of {pagingModel.TotalPages}";
}

var routeData = new Dictionary<string, string>();
routeData["CurrentPageIndex"] = pagingModel.CurrentPage.ToString();
var nextRouteData = new Dictionary<string, string>(routeData);
var previousRouteData = new Dictionary<string, string>(routeData);
nextRouteData["ReportFormActionType"] = ReportFormActionTypeEnum.NextPageChange.ToString();
previousRouteData["ReportFormActionType"] = ReportFormActionTypeEnum.PreviousPageChange.ToString();
}

@if (pagingModel.TotalPages > 1)
{
<nav class="nhsuk-pagination" role="navigation" aria-label="Pagination">
<ul class="nhsuk-list nhsuk-pagination__list">

@if (pagingModel.CurrentPage <= 0)
{
<li class="nhsuk-pagination-item--previous">

</li>
}
else
{
<li class="nhsuk-pagination-item--previous">
<a class="nhsuk-pagination__link nhsuk-pagination__link--prev" asp-action="Index" asp-all-route-data="@previousRouteData">
<span class="nhsuk-pagination__title">Previous</span>
<span class="nhsuk-u-visually-hidden">:</span>
<span class="nhsuk-pagination__page">@previousMessage</span>
<svg class="nhsuk-icon nhsuk-icon__arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" width="34" height="34">
<path d="M4.1 12.3l2.7 3c.2.2.5.2.7 0 .1-.1.1-.2.1-.3v-2h11c.6 0 1-.4 1-1s-.4-1-1-1h-11V9c0-.2-.1-.4-.3-.5h-.2c-.1 0-.3.1-.4.2l-2.7 3c0 .2 0 .4.1.6z"></path>
</svg>
</a>
</li>
}
@if (pagingModel.CurrentPage >= pagingModel.TotalPages - 1)
{
<li class="nhsuk-pagination-item--next">

</li>
}
else
{
<li class="nhsuk-pagination-item--next">
<a class="nhsuk-pagination__link nhsuk-pagination__link--next" asp-action="Index" asp-all-route-data="@nextRouteData">
<span class="nhsuk-pagination__title">Next</span>
<span class="nhsuk-u-visually-hidden">:</span>
<span class="nhsuk-pagination__page">@nextMessage</span>
<svg class="nhsuk-icon nhsuk-icon__arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" width="34" height="34">
<path d="M19.6 11.66l-2.73-3A.51.51 0 0 0 16 9v2H5a1 1 0 0 0 0 2h11v2a.5.5 0 0 0 .32.46.39.39 0 0 0 .18 0 .52.52 0 0 0 .37-.16l2.73-3a.5.5 0 0 0 0-.64z"></path>
</svg>
</a>
</li>
}
</ul>
</nav>
}
3 changes: 2 additions & 1 deletion LearningHub.Nhs.WebUI/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@
"MKPlayerLicence": "",
"MediaKindStorageConnectionString": ""
},
"StatMandId": 0,
"EnableTempDebugging": "false",
"LimitScormToAdmin": "false"

},
},
"LearningHubAuthServiceConfig": {
"Authority": "",
"ClientId": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class DatabricksConfig
/// <summary>
/// Gets or sets the client scret of the service pricncipl.
/// </summary>
public string clientSecret { get; set; } = null!;
public string ClientSecret { get; set; } = null!;

/// <summary>
/// Gets or sets the endpoint to check user permission.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
using LearningHub.Nhs.Models.Bookmark;
using LearningHub.Nhs.Models.Entities.Reporting;
using LearningHub.Nhs.OpenApi.Models.Configuration;
using LearningHub.Nhs.OpenApi.Models.Configuration;
using LearningHub.Nhs.OpenApi.Services.HttpClients;
using LearningHub.Nhs.OpenApi.Services.Interface.HttpClients;
using LearningHub.Nhs.OpenApi.Services.Interface.Services;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text.Json.Nodes;
using System.Text;
using System.Threading.Tasks;
using LearningHub.Nhs.Models.Databricks;
using System.Linq;
using System.Net.Http.Headers;
using LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories;
using LearningHub.Nhs.Models.Entities.DatabricksReport;
using AutoMapper;
using LearningHub.Nhs.Models.Entities.Activity;
using LearningHub.Nhs.Models.Resource.Activity;
using LearningHub.Nhs.Models.Common;
using LearningHub.Nhs.Models.Notification;
using Microsoft.EntityFrameworkCore;
using LearningHub.Nhs.Models.Enums.Report;
using Newtonsoft.Json.Linq;
using LearningHub.Nhs.OpenApi.Models.ViewModels;
using LearningHub.Nhs.Models.Resource;
using LearningHub.Nhs.OpenApi.Repositories.Repositories;
using LearningHub.Nhs.Models.Constants;
using LearningHub.Nhs.Models.Hierarchy;
using LearningHub.Nhs.Models.Enums;
using System.Text.Json;
using LearningHub.Nhs.Models.Entities.Resource;
using LearningHub.Nhs.Models.Entities;

namespace LearningHub.Nhs.OpenApi.Services.Services
Expand Down Expand Up @@ -83,7 +67,7 @@ public DatabricksService(IOptions<DatabricksConfig> databricksConfig,IOptions<Le
/// <inheritdoc/>
public async Task<bool> IsUserReporter(int userId)
{
string cacheKey = $"{CacheKey}_{userId}";
string cacheKey = $"{userId}:{CacheKey}";
var userReportPermission = await this.cachingService.GetAsync<bool>(cacheKey);
if (userReportPermission.ResponseEnum == CacheReadResponseEnum.Found)
{
Expand Down Expand Up @@ -129,7 +113,6 @@ public async Task<bool> IsUserReporter(int userId)
/// <inheritdoc/>
public async Task<DatabricksDetailedViewModel> CourseCompletionReport(int userId, DatabricksRequestModel model)
{
userId = 22527;
newEntry:
if (model.ReportHistoryId == 0 && model.Take > 1)
{
Expand Down Expand Up @@ -214,7 +197,6 @@ public async Task<DatabricksDetailedViewModel> CourseCompletionReport(int userId
/// <inheritdoc/>
public async Task<PagedResultSet<ReportHistoryModel>> GetPagedReportHistory(int userId,int page, int pageSize)
{
userId = 22527;
var result = new PagedResultSet<ReportHistoryModel>();
var query = this.reportHistoryRepository.GetByUserIdAsync(userId);

Expand Down Expand Up @@ -242,7 +224,6 @@ public async Task<PagedResultSet<ReportHistoryModel>> GetPagedReportHistory(int
/// <inheritdoc/>
public async Task<ReportHistoryModel> GetPagedReportHistoryById(int userId, int reportHistoryId)
{
userId = 22527;
var result = new ReportHistoryModel();

var reportHistory = await this.reportHistoryRepository.GetByIdAsync(reportHistoryId);
Expand All @@ -266,7 +247,6 @@ public async Task<ReportHistoryModel> GetPagedReportHistoryById(int userId, int
/// <inheritdoc/>
public async Task<bool> QueueReportDownload(int userId, int reportHistoryId)
{
userId = 22527;
var result = new ReportHistoryModel();

var reportHistory = await this.reportHistoryRepository.GetByIdAsync(reportHistoryId);
Expand Down Expand Up @@ -302,7 +282,8 @@ public async Task<bool> QueueReportDownload(int userId, int reportHistoryId)
par_PageSize = 0,
par_PageNumber = 0,
par_Date_from = reportHistory.StartDate.GetValueOrDefault().ToString("yyyy-MM-dd"),
par_Date_to = reportHistory.EndDate.GetValueOrDefault().ToString("yyyy-MM-dd")
par_Date_to = reportHistory.EndDate.GetValueOrDefault().ToString("yyyy-MM-dd"),
par_reportId = reportHistoryId
}
};

Expand Down Expand Up @@ -332,7 +313,6 @@ public async Task<bool> QueueReportDownload(int userId, int reportHistoryId)
/// <inheritdoc/>
public async Task<ReportHistoryModel> DownloadReport(int userId, int reportHistoryId)
{
userId = 22527;
var response = new ReportHistoryModel();

var reportHistory = await this.reportHistoryRepository.GetByIdAsync(reportHistoryId);
Expand Down
6 changes: 5 additions & 1 deletion OpenAPI/LearningHub.Nhs.OpenApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
"WarehouseId": "",
"JobId": "",
"UserPermissionEndpoint": "",
"CourseCompletionEndpoint": ""
"CourseCompletionEndpoint": "",
"ResourceId": "",
"TenantId": "",
"ClientId": "",
"ClientSecret": ""
}
}
Loading