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

Release #445

Merged
merged 6 commits into from
Jun 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions actions/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ var PLATFORM_FILTER = ' AND EXISTS (SELECT 1 FROM project_platform pp WHERE pp.p
/* Filter based on review type */
var REVIEW_FILTER = ' AND EXISTS (SELECT 1 FROM project_info pi WHERE project_info_type_id = 79 AND value IN (@filter@) ' +
'AND p.project_id = pi.project_id)';

/* Filter based on event */
var EVENT_FILTER = ' AND NVL((select max(event_id) from contest_project_xref x, contest c where project_id = p.project_id and c.contest_id = x.contest_id), 0) IN (@filter@)';

/**
* The challenge type filter for challenges api.
Expand Down Expand Up @@ -182,7 +185,7 @@ var MY_CHALLENGES_FILTER = 'AND EXISTS ' +
var ALLOWABLE_QUERY_PARAMETER = [
"listType", "challengeType", "challengeName", "projectId", SORT_COLUMN,
"sortOrder", "pageIndex", "pageSize", "prizeLowerBound", "prizeUpperBound", "cmcTaskId", 'communityId',
"submissionEndFrom", "submissionEndTo", "technologies", "platforms", 'review'];
"submissionEndFrom", "submissionEndTo", "technologies", "platforms", 'review', 'event'];

/**
* Represents a list of valid query parameter for split challenges api.
Expand All @@ -191,7 +194,7 @@ var ALLOWABLE_QUERY_PARAMETER = [
var SPLIT_API_ALLOWABLE_QUERY_PARAMETER = [
"challengeType", "challengeName", "projectId", SORT_COLUMN,
"sortOrder", "pageIndex", "pageSize", "prizeLowerBound", "prizeUpperBound", 'communityId',
"submissionEndFrom", "submissionEndTo", 'type', 'platforms', 'technologies', 'review'];
"submissionEndFrom", "submissionEndTo", 'type', 'platforms', 'technologies', 'review', 'event'];

/**
* Represents a predefined list of valid sort column for active challenge.
Expand Down Expand Up @@ -799,6 +802,11 @@ var addFilter = function (sql, filter, isMyChallenges, helper, caller) {
sql.count = editSql(sql.count, REVIEW_FILTER, review);
sql.data = editSql(sql.data, REVIEW_FILTER, review);
}

if (_.isDefined(filter.event)) {
sql.count = editSql(sql.count, EVENT_FILTER, filter.event);
sql.data = editSql(sql.data, EVENT_FILTER, filter.event);
}

if (isMyChallenges) {
sql.count = editSql(sql.count, MY_CHALLENGES_FILTER, null);
Expand Down Expand Up @@ -894,7 +902,7 @@ var searchChallenges = function (api, connection, dbConnectionMap, community, ne
query = connection.rawConnection.parsedURL.query,
caller = connection.caller,
copyToFilter = ["challengeType", "challengeName", "projectId", "prizeLowerBound",
"prizeUpperBound", "cmcTaskId", 'communityId', "submissionEndFrom", "submissionEndTo", "technologies", "platforms", "review"],
"prizeUpperBound", "cmcTaskId", 'communityId', "submissionEndFrom", "submissionEndTo", "technologies", "platforms", "review", "event"],
sqlParams = {},
filter = {},
pageIndex,
Expand Down Expand Up @@ -3654,7 +3662,7 @@ var getChallenges = function (api, connection, listType, isMyChallenges, next) {
query = connection.rawConnection.parsedURL.query,
caller = connection.caller,
copyToFilter = ["challengeType", "challengeName", "projectId", "prizeLowerBound",
"prizeUpperBound", 'communityId', "submissionEndFrom", "submissionEndTo", 'type', 'technologies', 'platforms', 'review'],
"prizeUpperBound", 'communityId', "submissionEndFrom", "submissionEndTo", 'type', 'technologies', 'platforms', 'review', 'event'],
dbConnectionMap = connection.dbConnectionMap,
sqlParams = {},
filter = {},
Expand Down
3 changes: 2 additions & 1 deletion actions/memberStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa
country: basic.country,
memberSince: basic.member_since,
quote: basic.quote,
photoLink: basic.photo_link || ''
photoLink: basic.photo_link || '',
copilot: basic.copilot || false
};

if (loadData.earnings && _.isDefined(basic.show_earnings) && basic.show_earnings !== 'hide') {
Expand Down
4 changes: 4 additions & 0 deletions queries/get_user_basic_profile_basic
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ SELECT
, co.quote
, p.path || i.file_name AS photo_link
, up.value AS show_earnings
, (copilot_profile_id IS NOT NULL) as copilot
FROM user u
, coder co
, OUTER copilot_profile cp
, OUTER country c
, OUTER(coder_image_xref cix
, image i
Expand All @@ -23,3 +25,5 @@ AND i.image_type_id = 1
AND i.path_id = p.path_id
AND u.user_id = up.user_id
AND up.preference_id = 100
AND u.user_id = cp.user_id
AND cp.copilot_profile_status_id = 1