From 8a127d9101c70ce73204a10b25da9382a1fb4a21 Mon Sep 17 00:00:00 2001 From: jamesdotcom Date: Thu, 3 Apr 2014 14:58:05 -0400 Subject: [PATCH 1/3] support optional param for user profile API with granular data retrieval; removed isPM, isCopilot --- actions/memberStatistics.js | 168 ++++++++++-------- config.js | 2 +- queries/get_user_basic_profile_basic | 15 -- test/test.basicUserProfile.js | 60 ++++++- .../expected_basic_user_profile_heffan.json | 6 - ...xpected_basic_user_profile_heffan_ach.json | 27 +++ ...c_user_profile_heffan_earning_ratings.json | 150 ++++++++++++++++ ...ected_basic_user_profile_heffan_is_pm.json | 6 - ...ted_basic_user_profile_heffan_no_data.json | 7 + ...ted_basic_user_profile_heffan_ratings.json | 149 ++++++++++++++++ ...asic_user_profile_heffan_show_earning.json | 6 - .../expected_basic_user_profile_super.json | 6 - ...basic_user_profile_dok_tester_private.json | 8 +- ...ted_basic_user_profile_heffan_private.json | 6 - ...cted_basic_user_profile_super_private.json | 8 +- ...ected_basic_user_profile_user_private.json | 8 +- 16 files changed, 484 insertions(+), 148 deletions(-) create mode 100755 test/test_files/expected_basic_user_profile_heffan_ach.json create mode 100755 test/test_files/expected_basic_user_profile_heffan_earning_ratings.json create mode 100755 test/test_files/expected_basic_user_profile_heffan_no_data.json create mode 100755 test/test_files/expected_basic_user_profile_heffan_ratings.json diff --git a/actions/memberStatistics.js b/actions/memberStatistics.js index 7b0b97bdc..3522f6c65 100644 --- a/actions/memberStatistics.js +++ b/actions/memberStatistics.js @@ -1,8 +1,8 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.14 - * @author Sky_, Ghost_141, muzehyun, hesibo, isv, LazyChild + * @version 1.15 + * @author Sky_, Ghost_141, muzehyun, hesibo, isv, LazyChild, jamestc * changes in 1.1: * - implement marathon statistics * changes in 1.2: @@ -36,6 +36,8 @@ * changes in 1.14 * - added my profile api * - modified public profile api(basic user profile api), only return public information + * changes in 1.15 + * - enabled granular data access in getBasicUserProfile via optional query param */ "use strict"; var async = require('async'); @@ -118,6 +120,24 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa }, result; + var loadData; + // check for an optional data query string param than enables loading a subset of data + var requestedData = connection.rawConnection.parsedURL.query.data; + if (_.isDefined(requestedData)) { + // NOTE: an empty value is acceptable and indicates only basic data is returned + loadData = {}; + if (requestedData) { + // data is comma delimited string of requested data + var parts = requestedData.split(','); + _.each(parts, function (part) { + loadData[part] = true; + }); + } + api.log("Requested data param found: " + requestedData, "debug"); + } else { + loadData = {earnings:true, ratings:true, achievements:true, address:true, email:true}; // load all data by default + } + async.waterfall([ function (cb) { if (privateInfoEligibility) { @@ -139,103 +159,95 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa }; async.parallel({ basic: execQuery('basic'), - earning: execQuery('overall_earning'), - ratingSummary: execQuery('rating_summary'), - achievements: execQuery('achievements'), - privateInfo: privateInfoEligibility ? execQuery('private') : function (cbx) { cbx(); }, - emails: privateInfoEligibility ? execQuery('private_email') : function (cbx) { cbx(); } + earning: loadData.earnings ? execQuery('overall_earning') : function(cbx) { cbx(); }, + ratingSummary: loadData.ratings ? execQuery('rating_summary') : function(cbx) { cbx(); }, + achievements: loadData.achievements ? execQuery('achievements') : function(cbx) { cbx(); }, + privateInfo: loadData.address && privateInfoEligibility ? execQuery('private') : function (cbx) { cbx(); }, + emails: loadData.email && privateInfoEligibility ? execQuery('private_email') : function (cbx) { cbx(); } }, cb); }, function (results, cb) { - var basic = results.basic[0], earning = results.earning[0], ratingSummary = results.ratingSummary, - achievements = results.achievements, privateInfo, - mapRatingSummary = function (ratings) { - var ret = []; - ratings.forEach(function (item) { - ret.push({ - name: helper.getPhaseName(item.phase_id), - rating: item.rating, - colorStyle: helper.getColorStyle(item.rating) - }); + var basic = results.basic[0]; + + result = { + handle: basic.handle, + country: basic.country, + memberSince: basic.member_since, + quote: basic.quote, + photoLink: basic.photo_link || '' + }; + + if (loadData.earnings && _.isDefined(basic.show_earnings) && basic.show_earnings !== 'hide') { + result.overallEarning = results.earning[0].overall_earning; + } + + if (loadData.ratings) { + var ratingSummary = []; + results.ratingSummary.forEach(function (item) { + ratingSummary.push({ + name: helper.getPhaseName(item.phase_id), + rating: item.rating, + colorStyle: helper.getColorStyle(item.rating) }); - return ret; - }, - mapAchievements = function (achievements) { - var ret = [], achieveItem; - achievements.forEach(function (item) { - achieveItem = { - date: item.achievement_date, - description: item.description - }; - ret.push(achieveItem); + }); + result.ratingSummary = ratingSummary; + } + + if (loadData.achievements) { + var achievements = []; + results.achievements.forEach(function (item) { + achievements.push({ + date: item.achievement_date, + description: item.description }); - return ret; - }, - mapEmails = function (emails) { - var ret = []; - emails.forEach(function (item) { - ret.push({ - email: item.email, - type: item.type, - status: item.status - }); + }); + // TODO: why is this capitalized? + result.Achievements = achievements; + } + + if (privateInfoEligibility && loadData.email) { + var emails = []; + results.emails.forEach(function (item) { + emails.push({ + email: item.email, + type: item.type, + status: item.status }); - return ret; - }, - appendIfNotEmpty = function (str) { + }); + result.emails = emails; + } + + if (privateInfoEligibility && loadData.address && results.privateInfo && results.privateInfo[0]) { + var appendIfNotEmpty = function (str) { var ret = ''; if (str && str.length > 0) { ret += ', ' + str; } return ret; - }, - getAddressString = function (privateInfo) { - var address = privateInfo.address1; - if (!address) { return undefined; } // if address1 is undefined, there is no address. + }; + + var privateInfo = results.privateInfo[0]; + + result.name = privateInfo.first_name + ' ' + privateInfo.last_name; + result.age = privateInfo.age; + result.gender = privateInfo.gender; + result.shirtSize = privateInfo.shirt_size; + var address = privateInfo.address1; + // if address1 is undefined, there is no address. + if (address) { address += appendIfNotEmpty(privateInfo.address2); address += appendIfNotEmpty(privateInfo.address3); address += ', ' + privateInfo.city; address += appendIfNotEmpty(privateInfo.state); address += ', ' + privateInfo.zip + ', ' + privateInfo.country; - return address; - }; - result = { - handle: basic.handle, - country: basic.country, - memberSince: basic.member_since, - overallEarning: earning.overall_earning, - quote: basic.quote, - photoLink: basic.photo_link || '', - isCopilot: { - value: basic.is_copilot, - software: basic.is_software_copilot, - studio: basic.is_studio_copilot - }, - isPM: basic.is_pm, - - ratingSummary: mapRatingSummary(ratingSummary), - Achievements: mapAchievements(achievements) - }; - - if (!_.isDefined(basic.show_earnings) || basic.show_earnings === 'hide') { - delete result.overallEarning; + result.address = address; + } } if (result.isPM) { delete result.ratingSummary; } - if (privateInfoEligibility) { - result.emails = mapEmails(results.emails); - if (results.privateInfo && results.privateInfo[0]) { - privateInfo = results.privateInfo[0]; - result.name = privateInfo.first_name + ' ' + privateInfo.last_name; - result.address = getAddressString(privateInfo); - result.age = privateInfo.age; - result.gender = privateInfo.gender; - result.shirtSize = privateInfo.shirt_size; - } - } cb(); } ], function (err) { @@ -1094,4 +1106,4 @@ exports.getMyProfile = { api.helper.handleNoConnection(api, connection, next); } } -}; \ No newline at end of file +}; diff --git a/config.js b/config.js index f8b6ff69c..ba72a78f5 100644 --- a/config.js +++ b/config.js @@ -193,7 +193,7 @@ config.tasks = { // ['high,low'] is one worker working 2 queues queues: ['default'], // how long to sleep between jobs / scheduler checks - timeout: 5000, + timeout: 500000, // What redis server should we connect to for tasks / delayed jobs? redis: config.redis }; diff --git a/queries/get_user_basic_profile_basic b/queries/get_user_basic_profile_basic index 2d8f140be..cf79fc9e0 100644 --- a/queries/get_user_basic_profile_basic +++ b/queries/get_user_basic_profile_basic @@ -3,33 +3,18 @@ SELECT , c.country_name AS country , co.member_since , co.quote -, (CASE WHEN r.rating < 0 - THEN 't' - ELSE 'f' - END)::boolean AS is_pm -, (CASE WHEN cp.user_id>0 - THEN 't' - ELSE 'f' - END)::boolean AS is_copilot -, NVL(cp.is_software_copilot, 'f') AS is_software_copilot -, NVL(cp.is_studio_copilot, 'f') AS is_studio_copilot , p.path || i.file_name AS photo_link , up.value AS show_earnings FROM user u , coder co -, OUTER algo_rating r , OUTER country c -, OUTER tcs_catalog:copilot_profile AS cp , OUTER(coder_image_xref cix , image i , path p) , OUTER user_preference up WHERE u.handle_lower = LOWER('@handle@') AND u.status = 'A' -AND u.user_id = cp.user_id AND u.user_id = co.coder_id -AND u.user_id = r.coder_id -AND r.algo_rating_type_id = 1 AND u.user_id = cix.coder_id AND c.country_code = co.comp_country_code AND cix.display_flag = 1 diff --git a/test/test.basicUserProfile.js b/test/test.basicUserProfile.js index 8deca1438..f18c3606d 100755 --- a/test/test.basicUserProfile.js +++ b/test/test.basicUserProfile.js @@ -104,9 +104,11 @@ describe('Get Basic User Profile API', function () { var body = res.body, expected = require(name); delete body.serverInformation; delete body.requesterInformation; - body.Achievements.forEach(function (item) { - delete item.date; - }); + if (body.Achievements) { + body.Achievements.forEach(function (item) { + delete item.date; + }); + } assert.deepEqual(body, expected); cb(); }); @@ -120,6 +122,51 @@ describe('Get Basic User Profile API', function () { assertBasicUserProfile('/v2/users/heffan', './test_files/expected_basic_user_profile_heffan', done); }); + /** + * Test /v2/users/heffan?data= + * Should return success results for heffan without earnings, ratings and achievements. + */ + it('should return success results for heffan without earning, ratings and achievements', function (done) { + assertBasicUserProfile('/v2/users/heffan?data=', './test_files/expected_basic_user_profile_heffan_no_data', done); + }); + + /** + * Test /v2/users/heffan?data=achievements + * Should return success results for heffan with just achievements + */ + it('should return success results for heffan with just achievements', function (done) { + assertBasicUserProfile('/v2/users/heffan?data=achievements', './test_files/expected_basic_user_profile_heffan_ach', done); + }); + + /** + * Test /v2/users/heffan?data=rating + * Should return success results for heffan with just rating summary + */ + it('should return success results for heffan with just ratings', function (done) { + assertBasicUserProfile('/v2/users/heffan?data=ratings', './test_files/expected_basic_user_profile_heffan_ratings', done); + }); + + /** + * Test /v2/users/heffan?data=earnings,rating + * should show overallEarning and rating fields in the response. + */ + it('should show earnings and rating', function (done) { + async.waterfall([ + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'informixoltp__update_show_earning', 'informixoltp', cb); + }, + function (cb) { + assertBasicUserProfile('/v2/users/heffan?data=earnings,ratings', './test_files/expected_basic_user_profile_heffan_earning_ratings', cb); + } + ], function (err) { + if (err) { + done(err); + return; + } + done(); + }); + }); + /** * Test /v2/users/super. * Should return success results for super. @@ -132,6 +179,7 @@ describe('Get Basic User Profile API', function () { * Test /v2/users/heffan. * The heffan is now be upgraded to software copilot. The isCopilot.software should be true now. */ + /* isCopilot removed it('should be a software copilot', function (done) { async.waterfall([ function (cb) { @@ -161,11 +209,13 @@ describe('Get Basic User Profile API', function () { done(); }); }); + */ /** * Test /v2/users/heffan. * heffan has been upgraded to studio copilot. The isCopilot.studio should be true now. */ + /* isCopilot removed it('should be a studio copilot', function (done) { async.waterfall([ function (cb) { @@ -195,11 +245,13 @@ describe('Get Basic User Profile API', function () { done(); }); }); + */ /** * Test /v2/users/heffan. * heffan is PM now. So the rating summary data should not be showed. */ + /* isPM removed it('should show no rating summary data', function (done) { async.waterfall([ function (cb) { @@ -216,6 +268,8 @@ describe('Get Basic User Profile API', function () { done(); }); }); + */ + /** * Test /v2/users/heffan diff --git a/test/test_files/expected_basic_user_profile_heffan.json b/test/test_files/expected_basic_user_profile_heffan.json index 2b3851047..1da624106 100755 --- a/test/test_files/expected_basic_user_profile_heffan.json +++ b/test/test_files/expected_basic_user_profile_heffan.json @@ -4,12 +4,6 @@ "memberSince": "2001-05-09T01:04:42.000Z", "quote": "Acknowledge and move on.", "photoLink": "/i/m/test_image.png", - "isCopilot": { - "value": true, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [ { "name": "Design", diff --git a/test/test_files/expected_basic_user_profile_heffan_ach.json b/test/test_files/expected_basic_user_profile_heffan_ach.json new file mode 100755 index 000000000..37801f182 --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_ach.json @@ -0,0 +1,27 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png", + "Achievements": [ + { + "description": "Algorithm Coder of the Month" + }, + { + "description": "First Forum Post" + }, + { + "description": "One Hundred Forum Posts" + }, + { + "description": "First Passing Submission" + }, + { + "description": "First Milestone Prize" + }, + { + "description": "First Placement" + } + ] +} diff --git a/test/test_files/expected_basic_user_profile_heffan_earning_ratings.json b/test/test_files/expected_basic_user_profile_heffan_earning_ratings.json new file mode 100755 index 000000000..93ecc1e58 --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_earning_ratings.json @@ -0,0 +1,150 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "overallEarning": 1000, + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png", + "ratingSummary": [ + { + "name": "Design", + "rating": 801, + "colorStyle": "color: #999999" + }, + { + "name": "Development", + "rating": 159, + "colorStyle": "color: #999999" + }, + { + "name": "Specification", + "rating": 3486, + "colorStyle": "color: #EE0000" + }, + { + "name": "Architecture", + "rating": 197, + "colorStyle": "color: #999999" + }, + { + "name": "Bug Hunt", + "rating": 4295, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Suites", + "rating": 1923, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Assembly", + "rating": 2472, + "colorStyle": "color: #EE0000" + }, + { + "name": "Banners/Icons", + "rating": 315, + "colorStyle": "color: #999999" + }, + { + "name": "Web Design", + "rating": 1596, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Wireframes", + "rating": 1281, + "colorStyle": "color: #6666FF" + }, + { + "name": "UI Prototypes", + "rating": 1259, + "colorStyle": "color: #6666FF" + }, + { + "name": "Logo Design", + "rating": 261, + "colorStyle": "color: #999999" + }, + { + "name": "Print/Presentation", + "rating": 3456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Idea Generation", + "rating": 59, + "colorStyle": "color: #999999" + }, + { + "name": "Conceptualization", + "rating": 3209, + "colorStyle": "color: #EE0000" + }, + { + "name": "RIA Build", + "rating": 1241, + "colorStyle": "color: #6666FF" + }, + { + "name": "RIA Component", + "rating": 3778, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Scenarios", + "rating": 2977, + "colorStyle": "color: #EE0000" + }, + { + "name": "Widget or Mobile Screen Design", + "rating": 664, + "colorStyle": "color: #999999" + }, + { + "name": "Front-End Flash", + "rating": 68, + "colorStyle": "color: #999999" + }, + { + "name": "Application Front-End Design", + "rating": 1535, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Other", + "rating": 2456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Content Creation", + "rating": 3995, + "colorStyle": "color: #EE0000" + }, + { + "name": "Reporting", + "rating": 1158, + "colorStyle": "color: #00A900" + }, + { + "name": "First2Finish", + "rating": 2151, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Code", + "rating": 3416, + "colorStyle": "color: #EE0000" + }, + { + "name": "Algorithm", + "rating": 1000, + "colorStyle": "color: #00A900" + }, + { + "name": "Marathon Match", + "rating": 2000, + "colorStyle": "color: #DDCC00" + } + ] +} diff --git a/test/test_files/expected_basic_user_profile_heffan_is_pm.json b/test/test_files/expected_basic_user_profile_heffan_is_pm.json index aede91577..37801f182 100755 --- a/test/test_files/expected_basic_user_profile_heffan_is_pm.json +++ b/test/test_files/expected_basic_user_profile_heffan_is_pm.json @@ -4,12 +4,6 @@ "memberSince": "2001-05-09T01:04:42.000Z", "quote": "Acknowledge and move on.", "photoLink": "/i/m/test_image.png", - "isCopilot": { - "value": true, - "software": false, - "studio": false - }, - "isPM": true, "Achievements": [ { "description": "Algorithm Coder of the Month" diff --git a/test/test_files/expected_basic_user_profile_heffan_no_data.json b/test/test_files/expected_basic_user_profile_heffan_no_data.json new file mode 100755 index 000000000..77d039f9a --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_no_data.json @@ -0,0 +1,7 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png" +} diff --git a/test/test_files/expected_basic_user_profile_heffan_ratings.json b/test/test_files/expected_basic_user_profile_heffan_ratings.json new file mode 100755 index 000000000..1e5a3368a --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_ratings.json @@ -0,0 +1,149 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png", + "ratingSummary": [ + { + "name": "Design", + "rating": 801, + "colorStyle": "color: #999999" + }, + { + "name": "Development", + "rating": 159, + "colorStyle": "color: #999999" + }, + { + "name": "Specification", + "rating": 3486, + "colorStyle": "color: #EE0000" + }, + { + "name": "Architecture", + "rating": 197, + "colorStyle": "color: #999999" + }, + { + "name": "Bug Hunt", + "rating": 4295, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Suites", + "rating": 1923, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Assembly", + "rating": 2472, + "colorStyle": "color: #EE0000" + }, + { + "name": "Banners/Icons", + "rating": 315, + "colorStyle": "color: #999999" + }, + { + "name": "Web Design", + "rating": 1596, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Wireframes", + "rating": 1281, + "colorStyle": "color: #6666FF" + }, + { + "name": "UI Prototypes", + "rating": 1259, + "colorStyle": "color: #6666FF" + }, + { + "name": "Logo Design", + "rating": 261, + "colorStyle": "color: #999999" + }, + { + "name": "Print/Presentation", + "rating": 3456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Idea Generation", + "rating": 59, + "colorStyle": "color: #999999" + }, + { + "name": "Conceptualization", + "rating": 3209, + "colorStyle": "color: #EE0000" + }, + { + "name": "RIA Build", + "rating": 1241, + "colorStyle": "color: #6666FF" + }, + { + "name": "RIA Component", + "rating": 3778, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Scenarios", + "rating": 2977, + "colorStyle": "color: #EE0000" + }, + { + "name": "Widget or Mobile Screen Design", + "rating": 664, + "colorStyle": "color: #999999" + }, + { + "name": "Front-End Flash", + "rating": 68, + "colorStyle": "color: #999999" + }, + { + "name": "Application Front-End Design", + "rating": 1535, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Other", + "rating": 2456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Content Creation", + "rating": 3995, + "colorStyle": "color: #EE0000" + }, + { + "name": "Reporting", + "rating": 1158, + "colorStyle": "color: #00A900" + }, + { + "name": "First2Finish", + "rating": 2151, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Code", + "rating": 3416, + "colorStyle": "color: #EE0000" + }, + { + "name": "Algorithm", + "rating": 1000, + "colorStyle": "color: #00A900" + }, + { + "name": "Marathon Match", + "rating": 2000, + "colorStyle": "color: #DDCC00" + } + ] +} diff --git a/test/test_files/expected_basic_user_profile_heffan_show_earning.json b/test/test_files/expected_basic_user_profile_heffan_show_earning.json index 898849ab4..fca88db04 100755 --- a/test/test_files/expected_basic_user_profile_heffan_show_earning.json +++ b/test/test_files/expected_basic_user_profile_heffan_show_earning.json @@ -5,12 +5,6 @@ "overallEarning": 1000, "quote": "Acknowledge and move on.", "photoLink": "/i/m/test_image.png", - "isCopilot": { - "value": true, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [ { "name": "Design", diff --git a/test/test_files/expected_basic_user_profile_super.json b/test/test_files/expected_basic_user_profile_super.json index 22ddb3b9d..121b2e512 100644 --- a/test/test_files/expected_basic_user_profile_super.json +++ b/test/test_files/expected_basic_user_profile_super.json @@ -3,12 +3,6 @@ "memberSince": "2008-07-23T16:09:58.000Z", "quote": "Do unto your code, as your code would do unto you", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [] } diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json index c1fdeed64..be791823f 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json @@ -2,12 +2,6 @@ "handle": "dok_tester", "memberSince": "2008-02-15T13:43:53.000Z", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [], "emails": [ @@ -18,4 +12,4 @@ } ], "name": "dok dok" -} \ No newline at end of file +} diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json index 2cd6ea82c..8fd245ea3 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json @@ -4,12 +4,6 @@ "memberSince": "2001-05-09T01:04:42.000Z", "quote": "Acknowledge and move on.", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [ { "name": "Algorithm", diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json index ef99ce71e..43f109d18 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json @@ -3,12 +3,6 @@ "memberSince": "2008-07-23T16:09:58.000Z", "quote": "Do unto your code, as your code would do unto you", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [], "emails": [ @@ -26,4 +20,4 @@ "name": "super user", "address": "addr1, addr2, addr3, city1, Illinois, 61801, United States", "age": "18 - 24" -} \ No newline at end of file +} diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json index e257d74fb..c472c19e9 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json @@ -3,12 +3,6 @@ "memberSince": "2008-07-23T16:11:03.000Z", "quote": "carpe noctem", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [], "emails": [ @@ -20,4 +14,4 @@ ], "name": "normal user", "address": "addr1, addr2, addr3, city1, province1, 123123, Samoa" -} \ No newline at end of file +} From 3854454c1306f10462bc470ce34d808fb71b2e74 Mon Sep 17 00:00:00 2001 From: jamesdotcom Date: Thu, 3 Apr 2014 14:58:05 -0400 Subject: [PATCH 2/3] support optional param for user profile API with granular data retrieval; removed isPM, isCopilot --- actions/memberStatistics.js | 168 ++++++++++-------- queries/get_user_basic_profile_basic | 15 -- test/test.basicUserProfile.js | 60 ++++++- .../expected_basic_user_profile_heffan.json | 6 - ...xpected_basic_user_profile_heffan_ach.json | 27 +++ ...c_user_profile_heffan_earning_ratings.json | 150 ++++++++++++++++ ...ected_basic_user_profile_heffan_is_pm.json | 6 - ...ted_basic_user_profile_heffan_no_data.json | 7 + ...ted_basic_user_profile_heffan_ratings.json | 149 ++++++++++++++++ ...asic_user_profile_heffan_show_earning.json | 6 - .../expected_basic_user_profile_super.json | 6 - ...basic_user_profile_dok_tester_private.json | 8 +- ...ted_basic_user_profile_heffan_private.json | 6 - ...cted_basic_user_profile_super_private.json | 8 +- ...ected_basic_user_profile_user_private.json | 8 +- 15 files changed, 483 insertions(+), 147 deletions(-) create mode 100755 test/test_files/expected_basic_user_profile_heffan_ach.json create mode 100755 test/test_files/expected_basic_user_profile_heffan_earning_ratings.json create mode 100755 test/test_files/expected_basic_user_profile_heffan_no_data.json create mode 100755 test/test_files/expected_basic_user_profile_heffan_ratings.json diff --git a/actions/memberStatistics.js b/actions/memberStatistics.js index 7b0b97bdc..3522f6c65 100644 --- a/actions/memberStatistics.js +++ b/actions/memberStatistics.js @@ -1,8 +1,8 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.14 - * @author Sky_, Ghost_141, muzehyun, hesibo, isv, LazyChild + * @version 1.15 + * @author Sky_, Ghost_141, muzehyun, hesibo, isv, LazyChild, jamestc * changes in 1.1: * - implement marathon statistics * changes in 1.2: @@ -36,6 +36,8 @@ * changes in 1.14 * - added my profile api * - modified public profile api(basic user profile api), only return public information + * changes in 1.15 + * - enabled granular data access in getBasicUserProfile via optional query param */ "use strict"; var async = require('async'); @@ -118,6 +120,24 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa }, result; + var loadData; + // check for an optional data query string param than enables loading a subset of data + var requestedData = connection.rawConnection.parsedURL.query.data; + if (_.isDefined(requestedData)) { + // NOTE: an empty value is acceptable and indicates only basic data is returned + loadData = {}; + if (requestedData) { + // data is comma delimited string of requested data + var parts = requestedData.split(','); + _.each(parts, function (part) { + loadData[part] = true; + }); + } + api.log("Requested data param found: " + requestedData, "debug"); + } else { + loadData = {earnings:true, ratings:true, achievements:true, address:true, email:true}; // load all data by default + } + async.waterfall([ function (cb) { if (privateInfoEligibility) { @@ -139,103 +159,95 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa }; async.parallel({ basic: execQuery('basic'), - earning: execQuery('overall_earning'), - ratingSummary: execQuery('rating_summary'), - achievements: execQuery('achievements'), - privateInfo: privateInfoEligibility ? execQuery('private') : function (cbx) { cbx(); }, - emails: privateInfoEligibility ? execQuery('private_email') : function (cbx) { cbx(); } + earning: loadData.earnings ? execQuery('overall_earning') : function(cbx) { cbx(); }, + ratingSummary: loadData.ratings ? execQuery('rating_summary') : function(cbx) { cbx(); }, + achievements: loadData.achievements ? execQuery('achievements') : function(cbx) { cbx(); }, + privateInfo: loadData.address && privateInfoEligibility ? execQuery('private') : function (cbx) { cbx(); }, + emails: loadData.email && privateInfoEligibility ? execQuery('private_email') : function (cbx) { cbx(); } }, cb); }, function (results, cb) { - var basic = results.basic[0], earning = results.earning[0], ratingSummary = results.ratingSummary, - achievements = results.achievements, privateInfo, - mapRatingSummary = function (ratings) { - var ret = []; - ratings.forEach(function (item) { - ret.push({ - name: helper.getPhaseName(item.phase_id), - rating: item.rating, - colorStyle: helper.getColorStyle(item.rating) - }); + var basic = results.basic[0]; + + result = { + handle: basic.handle, + country: basic.country, + memberSince: basic.member_since, + quote: basic.quote, + photoLink: basic.photo_link || '' + }; + + if (loadData.earnings && _.isDefined(basic.show_earnings) && basic.show_earnings !== 'hide') { + result.overallEarning = results.earning[0].overall_earning; + } + + if (loadData.ratings) { + var ratingSummary = []; + results.ratingSummary.forEach(function (item) { + ratingSummary.push({ + name: helper.getPhaseName(item.phase_id), + rating: item.rating, + colorStyle: helper.getColorStyle(item.rating) }); - return ret; - }, - mapAchievements = function (achievements) { - var ret = [], achieveItem; - achievements.forEach(function (item) { - achieveItem = { - date: item.achievement_date, - description: item.description - }; - ret.push(achieveItem); + }); + result.ratingSummary = ratingSummary; + } + + if (loadData.achievements) { + var achievements = []; + results.achievements.forEach(function (item) { + achievements.push({ + date: item.achievement_date, + description: item.description }); - return ret; - }, - mapEmails = function (emails) { - var ret = []; - emails.forEach(function (item) { - ret.push({ - email: item.email, - type: item.type, - status: item.status - }); + }); + // TODO: why is this capitalized? + result.Achievements = achievements; + } + + if (privateInfoEligibility && loadData.email) { + var emails = []; + results.emails.forEach(function (item) { + emails.push({ + email: item.email, + type: item.type, + status: item.status }); - return ret; - }, - appendIfNotEmpty = function (str) { + }); + result.emails = emails; + } + + if (privateInfoEligibility && loadData.address && results.privateInfo && results.privateInfo[0]) { + var appendIfNotEmpty = function (str) { var ret = ''; if (str && str.length > 0) { ret += ', ' + str; } return ret; - }, - getAddressString = function (privateInfo) { - var address = privateInfo.address1; - if (!address) { return undefined; } // if address1 is undefined, there is no address. + }; + + var privateInfo = results.privateInfo[0]; + + result.name = privateInfo.first_name + ' ' + privateInfo.last_name; + result.age = privateInfo.age; + result.gender = privateInfo.gender; + result.shirtSize = privateInfo.shirt_size; + var address = privateInfo.address1; + // if address1 is undefined, there is no address. + if (address) { address += appendIfNotEmpty(privateInfo.address2); address += appendIfNotEmpty(privateInfo.address3); address += ', ' + privateInfo.city; address += appendIfNotEmpty(privateInfo.state); address += ', ' + privateInfo.zip + ', ' + privateInfo.country; - return address; - }; - result = { - handle: basic.handle, - country: basic.country, - memberSince: basic.member_since, - overallEarning: earning.overall_earning, - quote: basic.quote, - photoLink: basic.photo_link || '', - isCopilot: { - value: basic.is_copilot, - software: basic.is_software_copilot, - studio: basic.is_studio_copilot - }, - isPM: basic.is_pm, - - ratingSummary: mapRatingSummary(ratingSummary), - Achievements: mapAchievements(achievements) - }; - - if (!_.isDefined(basic.show_earnings) || basic.show_earnings === 'hide') { - delete result.overallEarning; + result.address = address; + } } if (result.isPM) { delete result.ratingSummary; } - if (privateInfoEligibility) { - result.emails = mapEmails(results.emails); - if (results.privateInfo && results.privateInfo[0]) { - privateInfo = results.privateInfo[0]; - result.name = privateInfo.first_name + ' ' + privateInfo.last_name; - result.address = getAddressString(privateInfo); - result.age = privateInfo.age; - result.gender = privateInfo.gender; - result.shirtSize = privateInfo.shirt_size; - } - } cb(); } ], function (err) { @@ -1094,4 +1106,4 @@ exports.getMyProfile = { api.helper.handleNoConnection(api, connection, next); } } -}; \ No newline at end of file +}; diff --git a/queries/get_user_basic_profile_basic b/queries/get_user_basic_profile_basic index 2d8f140be..cf79fc9e0 100644 --- a/queries/get_user_basic_profile_basic +++ b/queries/get_user_basic_profile_basic @@ -3,33 +3,18 @@ SELECT , c.country_name AS country , co.member_since , co.quote -, (CASE WHEN r.rating < 0 - THEN 't' - ELSE 'f' - END)::boolean AS is_pm -, (CASE WHEN cp.user_id>0 - THEN 't' - ELSE 'f' - END)::boolean AS is_copilot -, NVL(cp.is_software_copilot, 'f') AS is_software_copilot -, NVL(cp.is_studio_copilot, 'f') AS is_studio_copilot , p.path || i.file_name AS photo_link , up.value AS show_earnings FROM user u , coder co -, OUTER algo_rating r , OUTER country c -, OUTER tcs_catalog:copilot_profile AS cp , OUTER(coder_image_xref cix , image i , path p) , OUTER user_preference up WHERE u.handle_lower = LOWER('@handle@') AND u.status = 'A' -AND u.user_id = cp.user_id AND u.user_id = co.coder_id -AND u.user_id = r.coder_id -AND r.algo_rating_type_id = 1 AND u.user_id = cix.coder_id AND c.country_code = co.comp_country_code AND cix.display_flag = 1 diff --git a/test/test.basicUserProfile.js b/test/test.basicUserProfile.js index 8deca1438..f18c3606d 100755 --- a/test/test.basicUserProfile.js +++ b/test/test.basicUserProfile.js @@ -104,9 +104,11 @@ describe('Get Basic User Profile API', function () { var body = res.body, expected = require(name); delete body.serverInformation; delete body.requesterInformation; - body.Achievements.forEach(function (item) { - delete item.date; - }); + if (body.Achievements) { + body.Achievements.forEach(function (item) { + delete item.date; + }); + } assert.deepEqual(body, expected); cb(); }); @@ -120,6 +122,51 @@ describe('Get Basic User Profile API', function () { assertBasicUserProfile('/v2/users/heffan', './test_files/expected_basic_user_profile_heffan', done); }); + /** + * Test /v2/users/heffan?data= + * Should return success results for heffan without earnings, ratings and achievements. + */ + it('should return success results for heffan without earning, ratings and achievements', function (done) { + assertBasicUserProfile('/v2/users/heffan?data=', './test_files/expected_basic_user_profile_heffan_no_data', done); + }); + + /** + * Test /v2/users/heffan?data=achievements + * Should return success results for heffan with just achievements + */ + it('should return success results for heffan with just achievements', function (done) { + assertBasicUserProfile('/v2/users/heffan?data=achievements', './test_files/expected_basic_user_profile_heffan_ach', done); + }); + + /** + * Test /v2/users/heffan?data=rating + * Should return success results for heffan with just rating summary + */ + it('should return success results for heffan with just ratings', function (done) { + assertBasicUserProfile('/v2/users/heffan?data=ratings', './test_files/expected_basic_user_profile_heffan_ratings', done); + }); + + /** + * Test /v2/users/heffan?data=earnings,rating + * should show overallEarning and rating fields in the response. + */ + it('should show earnings and rating', function (done) { + async.waterfall([ + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'informixoltp__update_show_earning', 'informixoltp', cb); + }, + function (cb) { + assertBasicUserProfile('/v2/users/heffan?data=earnings,ratings', './test_files/expected_basic_user_profile_heffan_earning_ratings', cb); + } + ], function (err) { + if (err) { + done(err); + return; + } + done(); + }); + }); + /** * Test /v2/users/super. * Should return success results for super. @@ -132,6 +179,7 @@ describe('Get Basic User Profile API', function () { * Test /v2/users/heffan. * The heffan is now be upgraded to software copilot. The isCopilot.software should be true now. */ + /* isCopilot removed it('should be a software copilot', function (done) { async.waterfall([ function (cb) { @@ -161,11 +209,13 @@ describe('Get Basic User Profile API', function () { done(); }); }); + */ /** * Test /v2/users/heffan. * heffan has been upgraded to studio copilot. The isCopilot.studio should be true now. */ + /* isCopilot removed it('should be a studio copilot', function (done) { async.waterfall([ function (cb) { @@ -195,11 +245,13 @@ describe('Get Basic User Profile API', function () { done(); }); }); + */ /** * Test /v2/users/heffan. * heffan is PM now. So the rating summary data should not be showed. */ + /* isPM removed it('should show no rating summary data', function (done) { async.waterfall([ function (cb) { @@ -216,6 +268,8 @@ describe('Get Basic User Profile API', function () { done(); }); }); + */ + /** * Test /v2/users/heffan diff --git a/test/test_files/expected_basic_user_profile_heffan.json b/test/test_files/expected_basic_user_profile_heffan.json index 2b3851047..1da624106 100755 --- a/test/test_files/expected_basic_user_profile_heffan.json +++ b/test/test_files/expected_basic_user_profile_heffan.json @@ -4,12 +4,6 @@ "memberSince": "2001-05-09T01:04:42.000Z", "quote": "Acknowledge and move on.", "photoLink": "/i/m/test_image.png", - "isCopilot": { - "value": true, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [ { "name": "Design", diff --git a/test/test_files/expected_basic_user_profile_heffan_ach.json b/test/test_files/expected_basic_user_profile_heffan_ach.json new file mode 100755 index 000000000..37801f182 --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_ach.json @@ -0,0 +1,27 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png", + "Achievements": [ + { + "description": "Algorithm Coder of the Month" + }, + { + "description": "First Forum Post" + }, + { + "description": "One Hundred Forum Posts" + }, + { + "description": "First Passing Submission" + }, + { + "description": "First Milestone Prize" + }, + { + "description": "First Placement" + } + ] +} diff --git a/test/test_files/expected_basic_user_profile_heffan_earning_ratings.json b/test/test_files/expected_basic_user_profile_heffan_earning_ratings.json new file mode 100755 index 000000000..93ecc1e58 --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_earning_ratings.json @@ -0,0 +1,150 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "overallEarning": 1000, + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png", + "ratingSummary": [ + { + "name": "Design", + "rating": 801, + "colorStyle": "color: #999999" + }, + { + "name": "Development", + "rating": 159, + "colorStyle": "color: #999999" + }, + { + "name": "Specification", + "rating": 3486, + "colorStyle": "color: #EE0000" + }, + { + "name": "Architecture", + "rating": 197, + "colorStyle": "color: #999999" + }, + { + "name": "Bug Hunt", + "rating": 4295, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Suites", + "rating": 1923, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Assembly", + "rating": 2472, + "colorStyle": "color: #EE0000" + }, + { + "name": "Banners/Icons", + "rating": 315, + "colorStyle": "color: #999999" + }, + { + "name": "Web Design", + "rating": 1596, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Wireframes", + "rating": 1281, + "colorStyle": "color: #6666FF" + }, + { + "name": "UI Prototypes", + "rating": 1259, + "colorStyle": "color: #6666FF" + }, + { + "name": "Logo Design", + "rating": 261, + "colorStyle": "color: #999999" + }, + { + "name": "Print/Presentation", + "rating": 3456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Idea Generation", + "rating": 59, + "colorStyle": "color: #999999" + }, + { + "name": "Conceptualization", + "rating": 3209, + "colorStyle": "color: #EE0000" + }, + { + "name": "RIA Build", + "rating": 1241, + "colorStyle": "color: #6666FF" + }, + { + "name": "RIA Component", + "rating": 3778, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Scenarios", + "rating": 2977, + "colorStyle": "color: #EE0000" + }, + { + "name": "Widget or Mobile Screen Design", + "rating": 664, + "colorStyle": "color: #999999" + }, + { + "name": "Front-End Flash", + "rating": 68, + "colorStyle": "color: #999999" + }, + { + "name": "Application Front-End Design", + "rating": 1535, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Other", + "rating": 2456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Content Creation", + "rating": 3995, + "colorStyle": "color: #EE0000" + }, + { + "name": "Reporting", + "rating": 1158, + "colorStyle": "color: #00A900" + }, + { + "name": "First2Finish", + "rating": 2151, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Code", + "rating": 3416, + "colorStyle": "color: #EE0000" + }, + { + "name": "Algorithm", + "rating": 1000, + "colorStyle": "color: #00A900" + }, + { + "name": "Marathon Match", + "rating": 2000, + "colorStyle": "color: #DDCC00" + } + ] +} diff --git a/test/test_files/expected_basic_user_profile_heffan_is_pm.json b/test/test_files/expected_basic_user_profile_heffan_is_pm.json index aede91577..37801f182 100755 --- a/test/test_files/expected_basic_user_profile_heffan_is_pm.json +++ b/test/test_files/expected_basic_user_profile_heffan_is_pm.json @@ -4,12 +4,6 @@ "memberSince": "2001-05-09T01:04:42.000Z", "quote": "Acknowledge and move on.", "photoLink": "/i/m/test_image.png", - "isCopilot": { - "value": true, - "software": false, - "studio": false - }, - "isPM": true, "Achievements": [ { "description": "Algorithm Coder of the Month" diff --git a/test/test_files/expected_basic_user_profile_heffan_no_data.json b/test/test_files/expected_basic_user_profile_heffan_no_data.json new file mode 100755 index 000000000..77d039f9a --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_no_data.json @@ -0,0 +1,7 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png" +} diff --git a/test/test_files/expected_basic_user_profile_heffan_ratings.json b/test/test_files/expected_basic_user_profile_heffan_ratings.json new file mode 100755 index 000000000..1e5a3368a --- /dev/null +++ b/test/test_files/expected_basic_user_profile_heffan_ratings.json @@ -0,0 +1,149 @@ +{ + "handle": "heffan", + "country": "United States", + "memberSince": "2001-05-09T01:04:42.000Z", + "quote": "Acknowledge and move on.", + "photoLink": "/i/m/test_image.png", + "ratingSummary": [ + { + "name": "Design", + "rating": 801, + "colorStyle": "color: #999999" + }, + { + "name": "Development", + "rating": 159, + "colorStyle": "color: #999999" + }, + { + "name": "Specification", + "rating": 3486, + "colorStyle": "color: #EE0000" + }, + { + "name": "Architecture", + "rating": 197, + "colorStyle": "color: #999999" + }, + { + "name": "Bug Hunt", + "rating": 4295, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Suites", + "rating": 1923, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Assembly", + "rating": 2472, + "colorStyle": "color: #EE0000" + }, + { + "name": "Banners/Icons", + "rating": 315, + "colorStyle": "color: #999999" + }, + { + "name": "Web Design", + "rating": 1596, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Wireframes", + "rating": 1281, + "colorStyle": "color: #6666FF" + }, + { + "name": "UI Prototypes", + "rating": 1259, + "colorStyle": "color: #6666FF" + }, + { + "name": "Logo Design", + "rating": 261, + "colorStyle": "color: #999999" + }, + { + "name": "Print/Presentation", + "rating": 3456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Idea Generation", + "rating": 59, + "colorStyle": "color: #999999" + }, + { + "name": "Conceptualization", + "rating": 3209, + "colorStyle": "color: #EE0000" + }, + { + "name": "RIA Build", + "rating": 1241, + "colorStyle": "color: #6666FF" + }, + { + "name": "RIA Component", + "rating": 3778, + "colorStyle": "color: #EE0000" + }, + { + "name": "Test Scenarios", + "rating": 2977, + "colorStyle": "color: #EE0000" + }, + { + "name": "Widget or Mobile Screen Design", + "rating": 664, + "colorStyle": "color: #999999" + }, + { + "name": "Front-End Flash", + "rating": 68, + "colorStyle": "color: #999999" + }, + { + "name": "Application Front-End Design", + "rating": 1535, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Other", + "rating": 2456, + "colorStyle": "color: #EE0000" + }, + { + "name": "Content Creation", + "rating": 3995, + "colorStyle": "color: #EE0000" + }, + { + "name": "Reporting", + "rating": 1158, + "colorStyle": "color: #00A900" + }, + { + "name": "First2Finish", + "rating": 2151, + "colorStyle": "color: #DDCC00" + }, + { + "name": "Code", + "rating": 3416, + "colorStyle": "color: #EE0000" + }, + { + "name": "Algorithm", + "rating": 1000, + "colorStyle": "color: #00A900" + }, + { + "name": "Marathon Match", + "rating": 2000, + "colorStyle": "color: #DDCC00" + } + ] +} diff --git a/test/test_files/expected_basic_user_profile_heffan_show_earning.json b/test/test_files/expected_basic_user_profile_heffan_show_earning.json index 898849ab4..fca88db04 100755 --- a/test/test_files/expected_basic_user_profile_heffan_show_earning.json +++ b/test/test_files/expected_basic_user_profile_heffan_show_earning.json @@ -5,12 +5,6 @@ "overallEarning": 1000, "quote": "Acknowledge and move on.", "photoLink": "/i/m/test_image.png", - "isCopilot": { - "value": true, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [ { "name": "Design", diff --git a/test/test_files/expected_basic_user_profile_super.json b/test/test_files/expected_basic_user_profile_super.json index 22ddb3b9d..121b2e512 100644 --- a/test/test_files/expected_basic_user_profile_super.json +++ b/test/test_files/expected_basic_user_profile_super.json @@ -3,12 +3,6 @@ "memberSince": "2008-07-23T16:09:58.000Z", "quote": "Do unto your code, as your code would do unto you", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [] } diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json index c1fdeed64..be791823f 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_dok_tester_private.json @@ -2,12 +2,6 @@ "handle": "dok_tester", "memberSince": "2008-02-15T13:43:53.000Z", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [], "emails": [ @@ -18,4 +12,4 @@ } ], "name": "dok dok" -} \ No newline at end of file +} diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json index 2cd6ea82c..8fd245ea3 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_heffan_private.json @@ -4,12 +4,6 @@ "memberSince": "2001-05-09T01:04:42.000Z", "quote": "Acknowledge and move on.", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [ { "name": "Algorithm", diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json index ef99ce71e..43f109d18 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_super_private.json @@ -3,12 +3,6 @@ "memberSince": "2008-07-23T16:09:58.000Z", "quote": "Do unto your code, as your code would do unto you", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [], "emails": [ @@ -26,4 +20,4 @@ "name": "super user", "address": "addr1, addr2, addr3, city1, Illinois, 61801, United States", "age": "18 - 24" -} \ No newline at end of file +} diff --git a/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json b/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json index e257d74fb..c472c19e9 100644 --- a/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json +++ b/test/test_files/user_profile_private/expected_basic_user_profile_user_private.json @@ -3,12 +3,6 @@ "memberSince": "2008-07-23T16:11:03.000Z", "quote": "carpe noctem", "photoLink": "", - "isCopilot": { - "value": false, - "software": false, - "studio": false - }, - "isPM": false, "ratingSummary": [], "Achievements": [], "emails": [ @@ -20,4 +14,4 @@ ], "name": "normal user", "address": "addr1, addr2, addr3, city1, province1, 123123, Samoa" -} \ No newline at end of file +} From d797f1b85fc9b6eaca680e0908baece6eb6785f5 Mon Sep 17 00:00:00 2001 From: jamesdotcom Date: Thu, 3 Apr 2014 15:14:13 -0400 Subject: [PATCH 3/3] allow timeout to be set via env var --- config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.js b/config.js index ba72a78f5..6e124e650 100644 --- a/config.js +++ b/config.js @@ -193,7 +193,7 @@ config.tasks = { // ['high,low'] is one worker working 2 queues queues: ['default'], // how long to sleep between jobs / scheduler checks - timeout: 500000, + timeout: process.env.TASK_TIMEOUT || 5000, // What redis server should we connect to for tasks / delayed jobs? redis: config.redis }; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy