From 871b48ac0e91f5c869d822833a5513f95f285a1b Mon Sep 17 00:00:00 2001 From: Thabo Date: Mon, 8 Jun 2015 15:05:25 -0700 Subject: [PATCH 1/5] show all challenges by default --- actions/challenges.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/actions/challenges.js b/actions/challenges.js index 88fb6b460..c7703307f 100755 --- a/actions/challenges.js +++ b/actions/challenges.js @@ -796,13 +796,9 @@ var addFilter = function (sql, filter, isMyChallenges, helper, caller) { if (_.isDefined(filter.review)) { review = "'" + filter.review.toUpperCase().replace(/,/g, "','") + "'"; + sql.count = editSql(sql.count, REVIEW_FILTER, review); + sql.data = editSql(sql.data, REVIEW_FILTER, review); } - else { - review = "'COMMUNITY','INTERNAL'"; - } - - sql.count = editSql(sql.count, REVIEW_FILTER, review); - sql.data = editSql(sql.data, REVIEW_FILTER, review); if (isMyChallenges) { sql.count = editSql(sql.count, MY_CHALLENGES_FILTER, null); From d561a3976c5c17c1311d4c075c16536355dee6d2 Mon Sep 17 00:00:00 2001 From: Thabo Date: Tue, 9 Jun 2015 11:46:39 -0700 Subject: [PATCH 2/5] peer review registration email --- actions/challengeRegistration.js | 8 ++++++-- mail_templates/peer_registration/html.ejs | 14 ++++++++++++++ mail_templates/peer_registration/style.css | 3 +++ mail_templates/peer_registration/text.ejs | 14 ++++++++++++++ .../registration_notification_email/text.ejs | 17 +++++++++++++++-- queries/get_component_info | 14 ++++++++++---- 6 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 mail_templates/peer_registration/html.ejs create mode 100644 mail_templates/peer_registration/style.css create mode 100644 mail_templates/peer_registration/text.ejs diff --git a/actions/challengeRegistration.js b/actions/challengeRegistration.js index 791121d3f..5b0c09319 100644 --- a/actions/challengeRegistration.js +++ b/actions/challengeRegistration.js @@ -403,8 +403,12 @@ var sendNotificationEmail = function (api, componentInfo, userId, activeForumCat forumURL = api.config.tcConfig.studioForumsUrlPrefix + activeForumCategoryId; submitURL = process.env.TC_STUDIO_SERVER_NAME + '/?module=ViewContestDetails&ct=' + challengeId; } - - template = 'registration_notification_email'; + + if (componentInfo.review_type && componentInfo.review_type == 'PEER') + template = 'peer_review_registration'; + else + template = 'registration_notification_email'; + if (challengeType === CHALLENGE_TYPE.DESIGN) { template = 'design_registration_notification_email'; // Get forum type diff --git a/mail_templates/peer_registration/html.ejs b/mail_templates/peer_registration/html.ejs new file mode 100644 index 000000000..0631a3ba0 --- /dev/null +++ b/mail_templates/peer_registration/html.ejs @@ -0,0 +1,14 @@ +

Hi <%= userName %>,

+ +

Congratulations! You are now registered for <%= projectName %> Challenge.

+ +

You now have access to the challenge discussion forum ( <%= forumURL %> ), which may have important information or documentation<%= documentationDetails %> about the challenge. It is also the place to ask questions regarding the challenge. Please post your questions at any time and the challenge holder will respond within 24 hours. Any questions asked within a few hours of the submission deadline may not be answered in time, so get your questions in early!

+ +

The deadline for submitting a solution is <%= deadlineDate %>. Please upload your submission here: <%= submitURL %>. If you encounter any problems, please contact us at support@topcoder.com. All late submissions will be ignored.

+ +

Need more information about competing? Visit the Help Center at http://help.topcoder.com.

+ +

Do you have questions or technical problems? Please contact support@topcoder.com.

+ +

Good luck!

+

The topcoder Team

\ No newline at end of file diff --git a/mail_templates/peer_registration/style.css b/mail_templates/peer_registration/style.css new file mode 100644 index 000000000..adc68fa6a --- /dev/null +++ b/mail_templates/peer_registration/style.css @@ -0,0 +1,3 @@ +h1 { + color: red; +} diff --git a/mail_templates/peer_registration/text.ejs b/mail_templates/peer_registration/text.ejs new file mode 100644 index 000000000..a92c60633 --- /dev/null +++ b/mail_templates/peer_registration/text.ejs @@ -0,0 +1,14 @@ +Hi <%= userName %>, + +Congratulations! You are now registered for <%= projectName %> Challenge. + +You now have access to the challenge discussion forum ( <%= forumURL %> ), which may have important information or documentation<%= documentationDetails %> about the challenge. It is also the place to ask questions regarding the challenge. Please post your questions at any time and the challenge holder will respond within 24 hours. Any questions asked within a few hours of the submission deadline may not be answered in time, so get your questions in early! + +The deadline for submitting a solution is <%= deadlineDate %>. Please upload your submission here: <%= submitURL %>. If you encounter any problems, please contact us at support@topcoder.com. All late submissions will be ignored. + +Need more information about competing? Visit the Help Center at http://help.topcoder.com. + +Do you have questions or technical problems? Please contact support@topcoder.com. + +Good luck! +The topcoder Team \ No newline at end of file diff --git a/mail_templates/registration_notification_email/text.ejs b/mail_templates/registration_notification_email/text.ejs index a8eec799c..dce77bd10 100644 --- a/mail_templates/registration_notification_email/text.ejs +++ b/mail_templates/registration_notification_email/text.ejs @@ -1,3 +1,16 @@ -Here is the registration notification email +Hi <%= userName %>, -Have fun! +Congratulations! You are now registered for <%= projectName %> Challenge. + +You now have access to the challenge discussion forum ( <%= forumURL %> ), which may have important information or documentation<%= documentationDetails %> about the challenge. It is also the place to ask questions regarding the challenge. Please post your questions at any time and the challenge holder will respond within 24 hours. Any questions asked within a few hours of the submission deadline may not be answered in time, so get your questions in early! + +The deadline for submitting a solution is <%= deadlineDate %>. Please upload your submission here: <%= submitURL %>. If you encounter any problems, please contact us at support@topcoder.com. All late submissions will be ignored. + +Additional tasks for this challenge can be accessed in Online Review. This is where you can unregister, contact a manager, view your review scorecard, submit appeals and final fixes, and other important tasks. <%= reviewURL %> + +Need more information about competing? Visit the Help Center at http://help.topcoder.com. + +Do you have questions or technical problems? Please contact support@topcoder.com. + +Good luck! +The topcoder Team diff --git a/queries/get_component_info b/queries/get_component_info index 262b8836e..40374a911 100644 --- a/queries/get_component_info +++ b/queries/get_component_info @@ -8,11 +8,17 @@ SELECT -- the project category id, e.g. Logo Design, Developemnt, Assembly (select project_category_id from project where project_id = @challengeId@ ) as project_category_id, -- the project name. - (select value from project_info where project_id = @challengeId@ AND project_info_type_id = 6 ) as project_name + (select value from project_info where project_id = @challengeId@ AND project_info_type_id = 6 ) as project_name, + pi79.value as review_type FROM comp_versions c - INNER JOIN project_info p ON c.component_id = p.value - INNER JOIN project_phase d ON d.project_id = @challengeId@ and phase_type_id = 2 + , project_info p + , project_phase d + , project_info pi79 WHERE p.project_info_type_id = 2 AND c.phase_id IN (112, 113) - AND p.project_id = @challengeId@ \ No newline at end of file + AND c.component_id = p.value + AND p.project_id = @challengeId@ + AND d.project_id = @challengeId@ and d.phase_type_id = 2 + AND pi79.project_info_type_id = 79 + AND pi79.project_id = @challengeId@ \ No newline at end of file From 2329becad879a43b6a3acc9f6491028d26c253d5 Mon Sep 17 00:00:00 2001 From: TonyJ Date: Tue, 9 Jun 2015 15:41:55 -0400 Subject: [PATCH 3/5] minor updates to email content --- mail_templates/peer_registration/html.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_templates/peer_registration/html.ejs b/mail_templates/peer_registration/html.ejs index 0631a3ba0..b783470dd 100644 --- a/mail_templates/peer_registration/html.ejs +++ b/mail_templates/peer_registration/html.ejs @@ -6,7 +6,7 @@

The deadline for submitting a solution is <%= deadlineDate %>. Please upload your submission here: <%= submitURL %>. If you encounter any problems, please contact us at support@topcoder.com. All late submissions will be ignored.

-

Need more information about competing? Visit the Help Center at http://help.topcoder.com.

+

Need more information? Visit the Help Center at http://help.topcoder.com.

Do you have questions or technical problems? Please contact support@topcoder.com.

From 2b2b5bfebf9014b8e418a3446e42155c12576254 Mon Sep 17 00:00:00 2001 From: Thabo Date: Tue, 9 Jun 2015 12:48:58 -0700 Subject: [PATCH 4/5] match html email content --- mail_templates/peer_registration/text.ejs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mail_templates/peer_registration/text.ejs b/mail_templates/peer_registration/text.ejs index a92c60633..367d29477 100644 --- a/mail_templates/peer_registration/text.ejs +++ b/mail_templates/peer_registration/text.ejs @@ -6,9 +6,9 @@ You now have access to the challenge discussion forum ( <%= forumURL %> ), which The deadline for submitting a solution is <%= deadlineDate %>. Please upload your submission here: <%= submitURL %>. If you encounter any problems, please contact us at support@topcoder.com. All late submissions will be ignored. -Need more information about competing? Visit the Help Center at http://help.topcoder.com. +Need more information? Visit the Help Center at http://help.topcoder.com. Do you have questions or technical problems? Please contact support@topcoder.com. Good luck! -The topcoder Team \ No newline at end of file +The topcoder Team From 25ce589375b4e0fe7b330787dfa3fc735172936d Mon Sep 17 00:00:00 2001 From: Thabo Date: Wed, 10 Jun 2015 15:20:20 -0700 Subject: [PATCH 5/5] attempt to auto register with the swift program if they came from apple --- actions/memberRegistration.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/actions/memberRegistration.js b/actions/memberRegistration.js index f95e0e1f4..cb75d89cf 100644 --- a/actions/memberRegistration.js +++ b/actions/memberRegistration.js @@ -33,6 +33,7 @@ var bignum = require("bignum"); var _ = require("underscore"); var IllegalArgumentError = require('../errors/IllegalArgumentError'); var BadRequestError = require('../errors/BadRequestError'); +var request = require('request'); /** * The max surname length @@ -1150,8 +1151,21 @@ exports.memberRegister = { if (err) { api.helper.handleError(api, connection, err); } else { - api.log("Member registration succeeded.", "debug"); - connection.response = {userId : result}; + var finalize = function() { + api.log("Member registration succeeded.", "debug"); + connection.response = {userId : result}; + }; + + if (connection.params.regSource !== null && connection.params.regSource === 'apple') { + request.post({ + headers: { 'Authorization' : 'Bearer ' + connection.rawConnection.req.headers.authorization }, + url: 'https://api.' + api.config.tcConfig.oauthDomain + '.com/v3/memberCert/registrations/' + result + '/programs/3445' + }, + function(error, response, body) { + finalize(); + }); + } + else finalize(); } next(connection, true);