@@ -1039,6 +1039,7 @@ var getChallenge = function (api, connection, dbConnectionMap, isStudio, next) {
10391039 isRelated = false , // This variable represent if the caller is related with challenge.
10401040 isRegistered = false , // This variable represent if the caller is already registered this challenge.
10411041 isCopilotPosting = false , //This variable represent if the challenge is a copilot posting challenge.
1042+ isManager = false , //This variable represent if the caller is a manager.
10421043 copilotDetailedRequirements ,
10431044 unified = connection . action === "getChallenge" ,
10441045 execQuery = function ( name ) {
@@ -1068,8 +1069,12 @@ var getChallenge = function (api, connection, dbConnectionMap, isStudio, next) {
10681069 return ;
10691070 }
10701071
1072+ if ( result [ 0 ] . is_manager ) {
1073+ isManager = true ;
1074+ }
1075+
10711076 // If the user has the access to the challenge or is a resource for the challenge then he is related with this challenge.
1072- if ( result [ 0 ] . has_access || result [ 0 ] . is_related || result [ 0 ] . is_manager || helper . isAdmin ( caller ) ) {
1077+ if ( result [ 0 ] . has_access || result [ 0 ] . is_related || isManager || helper . isAdmin ( caller ) ) {
10731078 isRelated = true ;
10741079 }
10751080
@@ -1170,6 +1175,13 @@ var getChallenge = function (api, connection, dbConnectionMap, isStudio, next) {
11701175 submissionsViewable : data . submissions_viewable
11711176 } ;
11721177
1178+ if ( ! challenge . submissionsViewable && isStudio ) {
1179+ // Admin and manager can view submissions anytime
1180+ if ( helper . isAdmin ( caller ) || isManager ) {
1181+ challenge . submissionsViewable = true ;
1182+ }
1183+ }
1184+
11731185 if ( unified ) {
11741186 challenge . type = isStudio ? 'design' : 'develop' ;
11751187 }
0 commit comments