11namespace 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" ) ]
0 commit comments