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 ; 
16+     using  Microsoft . FeatureManagement ; 
17+     using  Microsoft . FeatureManagement . Mvc ; 
18+     using  System ; 
19+     using  System . Threading . Tasks ; 
1720
1821    [ FeatureGate ( FeatureFlags . RefactoredTrackingSystem ) ] 
1922    [ Authorize ( Policy  =  CustomPolicies . UserCentreAdmin ) ] 
@@ -30,12 +33,14 @@ public class SelfAssessmentReportsController : Controller
3033        private  readonly  string  workbookName ; 
3134        private  readonly  string  viewName ; 
3235        private  readonly  ISelfAssessmentService  selfAssessmentService ; 
36+         private  readonly  IFeatureManager  featureManager ; 
3337        public  SelfAssessmentReportsController ( 
3438            ISelfAssessmentReportService  selfAssessmentReportService , 
3539            ITableauConnectionHelperService  tableauConnectionHelper , 
3640            IClockUtility  clockUtility , 
3741            IConfiguration  config , 
38-             ISelfAssessmentService  selfAssessmentService 
42+             ISelfAssessmentService  selfAssessmentService , 
43+             IFeatureManager  featureManager 
3944        ) 
4045        { 
4146            this . selfAssessmentReportService  =  selfAssessmentReportService ; 
@@ -46,13 +51,17 @@ ISelfAssessmentService selfAssessmentService
4651            workbookName  =  config . GetTableauWorkbookName ( ) ; 
4752            viewName  =  config . GetTableauViewName ( ) ; 
4853            this . selfAssessmentService  =  selfAssessmentService ; 
54+             this . featureManager  =  featureManager ; 
4955        } 
50-         public  IActionResult   Index ( ) 
56+         public  async   Task < IActionResult >   IndexAsync ( ) 
5157        { 
5258            var  centreId  =  User . GetCentreId ( ) ; 
5359            var  adminCategoryId  =  User . GetAdminCategoryId ( ) ; 
5460            var  categoryId  =  this . selfAssessmentService . GetSelfAssessmentCategoryId ( 1 ) ; 
55-             var  model  =  new  SelfAssessmentReportsViewModel ( selfAssessmentReportService . GetSelfAssessmentsForReportList ( ( int ) centreId ,  adminCategoryId ) ,  adminCategoryId ,  categoryId ) ; 
61+             var  tableauFlag  =  await  featureManager . IsEnabledAsync ( FeatureFlags . TableauSelfAssessmentDashboards ) ; 
62+             var  tableauQueryOverride  =  string . Equals ( Request . Query [ "tableaulink" ] ,  "true" ,  StringComparison . OrdinalIgnoreCase ) ; 
63+             var  showTableauLink  =  tableauFlag  ||  tableauQueryOverride ; 
64+             var  model  =  new  SelfAssessmentReportsViewModel ( selfAssessmentReportService . GetSelfAssessmentsForReportList ( ( int ) centreId ,  adminCategoryId ) ,  adminCategoryId ,  categoryId ,  showTableauLink ) ; 
5665            return  View ( model ) ; 
5766        } 
5867        [ HttpGet ] 
0 commit comments