Skip to content

Commit 5beabf1

Browse files
TD-5683 Issue showing self assessment reports on Tracking system which are not published at the centre
1 parent 30439cf commit 5beabf1

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Centre.SelfAssessmentReports
22
{
3+
using DigitalLearningSolutions.Data.Enums;
4+
using DigitalLearningSolutions.Data.Extensions;
35
using DigitalLearningSolutions.Data.Services;
4-
using DigitalLearningSolutions.Web.Helpers;
5-
using Microsoft.AspNetCore.Authorization;
6-
using Microsoft.AspNetCore.Mvc;
7-
using Microsoft.FeatureManagement.Mvc;
6+
using DigitalLearningSolutions.Data.Utilities;
87
using DigitalLearningSolutions.Web.Attributes;
8+
using DigitalLearningSolutions.Web.Helpers;
9+
using DigitalLearningSolutions.Web.Helpers.ExternalApis;
910
using DigitalLearningSolutions.Web.Models.Enums;
10-
using DigitalLearningSolutions.Data.Enums;
11-
using DigitalLearningSolutions.Data.Utilities;
11+
using DigitalLearningSolutions.Web.Services;
1212
using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Centre.Reports;
13-
using DigitalLearningSolutions.Web.Helpers.ExternalApis;
13+
using Microsoft.AspNetCore.Authorization;
14+
using Microsoft.AspNetCore.Mvc;
1415
using Microsoft.Extensions.Configuration;
15-
using DigitalLearningSolutions.Data.Extensions;
16-
using DigitalLearningSolutions.Web.Services;
17-
16+
using Microsoft.FeatureManagement.Mvc;
17+
using System.Linq;
1818
[FeatureGate(FeatureFlags.RefactoredTrackingSystem)]
1919
[Authorize(Policy = CustomPolicies.UserCentreAdmin)]
2020
[SetDlsSubApplication(nameof(DlsSubApplication.TrackingSystem))]
@@ -30,12 +30,14 @@ public class SelfAssessmentReportsController : Controller
3030
private readonly string workbookName;
3131
private readonly string viewName;
3232
private readonly ISelfAssessmentService selfAssessmentService;
33+
private readonly ICentreSelfAssessmentsService centreSelfAssessmentsService;
3334
public SelfAssessmentReportsController(
3435
ISelfAssessmentReportService selfAssessmentReportService,
3536
ITableauConnectionHelperService tableauConnectionHelper,
3637
IClockUtility clockUtility,
3738
IConfiguration config,
38-
ISelfAssessmentService selfAssessmentService
39+
ISelfAssessmentService selfAssessmentService,
40+
ICentreSelfAssessmentsService centreSelfAssessmentsService
3941
)
4042
{
4143
this.selfAssessmentReportService = selfAssessmentReportService;
@@ -46,14 +48,16 @@ ISelfAssessmentService selfAssessmentService
4648
workbookName = config.GetTableauWorkbookName();
4749
viewName = config.GetTableauViewName();
4850
this.selfAssessmentService = selfAssessmentService;
51+
this.centreSelfAssessmentsService = centreSelfAssessmentsService;
4952
}
5053
public IActionResult Index()
5154
{
5255
var centreId = User.GetCentreId();
5356
var adminCategoryId = User.GetAdminCategoryId();
5457
var categoryId = this.selfAssessmentService.GetSelfAssessmentCategoryId(1);
55-
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId);
56-
return View(model);
58+
var selfAssessments = centreSelfAssessmentsService.GetCentreSelfAssessments(centreId.Value);
59+
var dSATreportIsPublish = selfAssessments.Any(x => x.SelfAssessmentId == 1);
60+
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId, dSATreportIsPublish); return View(model);
5761
}
5862
[HttpGet]
5963
[Route("DownloadDcsa")]

DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
public class SelfAssessmentReportsViewModel
77
{
88
public SelfAssessmentReportsViewModel(
9-
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId
9+
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId, bool dSATreportIsPublish
1010
)
1111
{
1212
SelfAssessmentSelects = selfAssessmentSelects;
1313
AdminCategoryId = adminCategoryId;
1414
CategoryId = categoryId;
15+
DSATreportIsPublish = dSATreportIsPublish;
1516
}
1617
public IEnumerable<SelfAssessmentSelect> SelfAssessmentSelects { get; set; }
1718
public int? AdminCategoryId { get; set; }
1819
public int CategoryId { get; set; }
20+
public bool DSATreportIsPublish { get; set; }
1921
}
2022
}

0 commit comments

Comments
 (0)