178
178
<v-col cols =" 12" >
179
179
<DownloadLink
180
180
label =" Session Results.csv"
181
- :download-action =" () => downloadDetailedDOARReport ()"
181
+ :download-action =" () => downloadAssessmentResultCSV ()"
182
182
/>
183
183
</v-col >
184
184
</v-row >
@@ -290,22 +290,23 @@ export default {
290
290
schoolNameNumberFilter: null ,
291
291
schoolSearchNames: [],
292
292
selectedSessionID: null ,
293
- isDistrictUser: false ,
294
- schoolUserSchoolID: null
295
293
};
296
294
},
297
295
computed: {
298
296
... mapState (appStore, [' schoolsMap' ]),
299
297
... mapState (authStore, [' userInfo' ]),
300
298
disableCondition () {
301
299
return this .userInfo .activeInstituteType === ' DISTRICT' ? (! this .schoolNameNumberFilter || ! this .selectedSessionID ) : ! this .selectedSessionID ;
300
+ },
301
+ schoolIdentifierForReports () {
302
+ if (this .userInfo .activeInstituteType === ' SCHOOL' ) {
303
+ return this .userInfo .activeInstituteIdentifier ;
304
+ }
305
+ return this .schoolNameNumberFilter ;
302
306
}
303
307
},
304
308
async created () {
305
- authStore ().getUserInfo ().then (() => {
306
- this .isDistrictUser = this .userInfo .activeInstituteType !== ' SCHOOL' ;
307
- this .schoolUserSchoolID = this .userInfo .activeInstituteType === ' SCHOOL' ? this .userInfo .activeInstituteIdentifier : null ;
308
- });
309
+ authStore ().getUserInfo ();
309
310
await this .getAllSessions ();
310
311
this .setupSchoolLists ();
311
312
},
@@ -377,7 +378,21 @@ export default {
377
378
this .isSearchingStudent = false ;
378
379
});
379
380
},
380
-
381
+ async downloadAssessmentResultCSV () {
382
+ this .isLoading = true ;
383
+ try {
384
+ const url = ` ${ ApiRoutes .assessments .BASE_REPORTS_URL } /${ this .userInfo .activeInstituteType .toLowerCase ()} /${ this .selectedSessionID } /school/${ this .schoolIdentifierForReports } /sessionResultsCSV/download` ;
385
+ window .open (url);
386
+ } catch (error) {
387
+ console .error (error);
388
+ this .setFailureAlert (
389
+ error? .response ? .data ? .message ? error? .response ? .data ? .message : ' An error occurred while trying to retrieve your school\' s report.'
390
+ );
391
+ } finally {
392
+ this .isLoading = false ;
393
+ }
394
+
395
+ },
381
396
async downloadStudentReport () {
382
397
383
398
},
@@ -388,20 +403,17 @@ export default {
388
403
389
404
},
390
405
async downloadAssessmentResults () {
391
-
406
+
392
407
},
393
408
async downloadXamFile () {
394
409
this .isLoading = true ;
395
410
try {
396
- const url = ` ${ ApiRoutes .assessments .BASE_REPORTS_URL } /${ this .userInfo .activeInstituteType } /${ this .selectedSessionID } /school/${
397
- this .isDistrictUser ? this .schoolNameNumberFilter : this .schoolUserSchoolID } /download` ;
411
+ const url = ` ${ ApiRoutes .assessments .BASE_REPORTS_URL } /${ this .userInfo .activeInstituteType .toLowerCase ()} /${ this .selectedSessionID } /school/${ this .schoolIdentifierForReports } /xam/download` ;
398
412
window .open (url);
399
413
} catch (error) {
400
414
console .error (error);
401
415
this .setFailureAlert (
402
- error? .response ? .data ? .message
403
- ? error? .response ? .data ? .message
404
- : ' An error occurred while trying to retrieve your school\' s report.'
416
+ error? .response ? .data ? .message ? error? .response ? .data ? .message : ' An error occurred while trying to retrieve your school\' s report.'
405
417
);
406
418
} finally {
407
419
this .isLoading = false ;
0 commit comments