@@ -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 }
@@ -2371,8 +2383,8 @@ var getChallengeResults = function (api, connection, dbConnectionMap, isStudio,
23712383 //Submission Links
23722384 if ( isStudio ) {
23732385 if ( challengeRestrictions . show_submissions ) {
2374- resEl . submissionDownloadLink = api . config . tcConfig . designSubmissionLink + el . submission_id ;
2375- resEl . previewDownloadLink = api . config . tcConfig . designSubmissionLink + el . submission_id + "&sbt=small" ;
2386+ resEl . submissionDownloadLink = api . config . tcConfig . designSubmissionLink + el . submission_id + api . config . tcConfig . submissionDownloadLinkParams ;
2387+ resEl . previewDownloadLink = api . config . tcConfig . designSubmissionLink + el . submission_id + api . config . tcConfig . previewDownloadLinkParams ;
23762388 }
23772389 } else {
23782390 resEl . submissionDownloadLink = api . config . tcConfig . submissionLink + el . upload_id ;
@@ -2394,7 +2406,7 @@ var getChallengeResults = function (api, connection, dbConnectionMap, isStudio,
23942406 if ( isStudio ) {
23952407 if ( challengeRestrictions . show_submissions ) {
23962408 result . finalFixes = _ . map ( res . finalFixes , function ( ff ) {
2397- return api . config . tcConfig . designSubmissionLink + ff . submission_id ;
2409+ return api . config . tcConfig . designSubmissionLink + ff . submission_id + api . config . tcConfig . submissionDownloadLinkParams ;
23982410 } ) ;
23992411 }
24002412 } else {
@@ -3956,7 +3968,7 @@ var getUserSubmissions = function (api, connection, next) {
39563968 submission . download = api . config . tcConfig . submissionLink + item . upload_id ;
39573969 delete submission . ranking ;
39583970 } else {
3959- submission . download = api . config . tcConfig . designSubmissionLink + item . submission_id ;
3971+ submission . download = api . config . tcConfig . designSubmissionLink + item . submission_id + api . config . tcConfig . submissionDownloadLinkParams ;
39603972 }
39613973 return submission ;
39623974 } ) ;
0 commit comments