Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit b88050e

Browse files
authored
Merge pull request #473 from appirio-tech/kohata-fix-country-check
Fix for Issue: Do not allow a member to register for challenge if country is not set
2 parents c7ee58b + abc6079 commit b88050e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

initializers/challengeHelper.js

+6
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ exports.challengeHelper = function (api, next) {
161161
return;
162162
}
163163

164+
// Do not allow a member to register for challenge if country is not set
165+
if (rows[0].comp_country_is_null) {
166+
cb(new ForbiddenError('You cannot participate in this challenge as your country is not set.'));
167+
return;
168+
}
169+
164170
if (rows[0].project_category_id === COPILOT_POSTING_PROJECT_TYPE) {
165171
if (!rows[0].user_is_copilot && rows[0].copilot_type && rows[0].copilot_type.indexOf("Marathon Match") < 0) {
166172
cb(new ForbiddenError('You cannot participate in this challenge because you are not an active member of the copilot pool.'));

queries/challenge_registration_validations

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ select
77
(ce.contest_eligibility_id IS NULL) as no_elgibility_req,
88
(ugx.login_id IS NOT NULL) as user_in_eligible_group,
99
(uax.user_id IS NOT NULL OR coder.coder_id IS NOT NULL) as user_country_banned,
10+
(coder2.comp_country_code IS NULL) as comp_country_is_null,
1011
(cop.copilot_profile_id IS NOT NULL) as user_is_copilot,
1112
(pctl.name) as copilot_type
1213
from project p
@@ -50,6 +51,8 @@ left outer join (
5051
on coder.comp_country_code=country.country_code
5152
and country.country_name in ( "Iran", "North Korea", "Cuba", "Sudan", "Syria" )
5253
) on coder.coder_id = @userId@
54+
-- Get coder to check comp_country_code
55+
left outer join informixoltp:coder coder2 on coder2.coder_id = @userId@
5356
-- Get the copilot type
5457
left join (
5558
project_copilot_type pct join project_copilot_type_lu pctl

0 commit comments

Comments
 (0)