diff --git a/actions/challengeRegistration.js b/actions/challengeRegistration.js index 6b26c7e2e..c93d3f7ac 100644 --- a/actions/challengeRegistration.js +++ b/actions/challengeRegistration.js @@ -3,14 +3,17 @@ * * The APIs to register a challenge (studio category or software category) for the current logged-in user. * - * @version 1.2 - * @author ecnu_haozi, xjtufreeman, TCSASSEMBLER + * @version 1.3 + * @author ecnu_haozi, xjtufreeman, bugbuka * * changes in 1.1: * Combine Challenge Registration API(BUGR-11058) * * changes in 1.2: * Integrate the forums operation(Module Assembly - Integrating Forums Wrapper with Challenge Registration API) + * + * changes in 1.3: + * move common function getForumWrapper, aduitResourceAddition to challengeHelper.js */ "use strict"; @@ -26,25 +29,6 @@ var ForbiddenError = require('../errors/ForbiddenError'); */ var forumWrapper = null; -/** - * Get forum wrapper. It is initialized only once. - * @param {Object} api The api object that is used to access the infrastructure. - * @param {Function} callback the callback function - */ -var getForumWrapper = function (api, callback) { - if (forumWrapper) { - callback(null, forumWrapper); - } else { - try { - forumWrapper = new ForumWrapper(api.config.general.devForumJNDI); - callback(null, forumWrapper); - } catch (ex) { - api.log('Failed to connect to forum: ' + ex + " " + (ex.stack || ''), 'error'); - callback(new Error('Failed to connect to forum')); - } - } -}; - //constants var DESIGN_PROJECT_TYPE = 1, DEVELOPMENT_PROJECT_TYPE = 2, @@ -162,27 +146,6 @@ var persistResource = function (api, resourceId, userId, challengeId, dbConnecti }); }; -/** - * Audit the challenge registration on table 'tcs_catalog.project_user_audit'. - * - * @param {Object} api The api object that is used to access the infrastructure. - * @param {Number} userId The current logged-in user's id. - * @param {Number} challengeId The id of the challenge to register. - * @param {Object} dbConnectionMap The database connection map for the current request. - * @param {Function} next The callback to be called after this function is done. - */ -var aduitResourceAddition = function (api, userId, challengeId, dbConnectionMap, next) { - api.dataAccess.executeQuery("audit_challenge_registration", { - projectId: challengeId, - resourceUserId: userId, - resourceRoleId: SUBMITTER_RESOURCE_ROLE_ID, - auditActionTypeId: PROJECT_USER_AUDIT_CREATE_TYPE, - actionUserId: userId - }, - dbConnectionMap, - next); -}; - /** * Check if the rating suit for software category contests. * The code logic is duplicated from server-side java code. @@ -282,7 +245,7 @@ var projectTrack = function (api, userId, challengeId, componentInfo, dbConnecti function (resourceId, callback) { async.parallel([ function (cb) { - aduitResourceAddition(api, userId, challengeId, dbConnectionMap, cb); + api.challengeHelper.aduitResourceAddition(api, userId, challengeId, SUBMITTER_RESOURCE_ROLE_ID, PROJECT_USER_AUDIT_CREATE_TYPE, dbConnectionMap, cb); }, function (cb) { prepareProjectResult( @@ -487,7 +450,7 @@ var grantForumAccess = function (api, userId, activeForumCategoryId, next) { api.log('start to grant user ' + userId + ' forum category ' + activeForumCategoryId + ' access.'); async.waterfall([ function (cb) { - getForumWrapper(api, cb); + api.challengeHelper.getForumWrapper(api, cb); }, function (forumWrapper, cb) { forumWrapper.assignRole(userId, "Software_Users_" + activeForumCategoryId, function (err) { if (err) { @@ -646,8 +609,8 @@ var timelineNotification = function (api, userId, challengeId, dbConnectionMap, dbConnectionMap, cb); } else { - cb(null); - } + cb(null); + } } ], next); }; @@ -685,23 +648,23 @@ var registerSoftwareChallengeAction = function (api, connection, next) { if (connection.dbConnectionMap) { api.log("Execute registerSoftwareChallengeAction#run", 'debug'); - var challengeId = Number(connection.params.challengeId); - var sqlParams = { - challengeId: challengeId, - user_id: connection.caller.userId - }; - var execQuery = function (name) { - return function (cbx) { - api.dataAccess.executeQuery(name, sqlParams, connection.dbConnectionMap, cbx); + var challengeId = Number(connection.params.challengeId), + sqlParams = { + challengeId: challengeId, + user_id: connection.caller.userId + }, + execQuery = function (name) { + return function (cbx) { + api.dataAccess.executeQuery(name, sqlParams, connection.dbConnectionMap, cbx); + }; }; - }; async.waterfall([ - function(cb) { + function (cb) { async.parallel({ isCopilotPosting: execQuery('check_challenge_is_copilot_posting'), isCopilot: execQuery('check_is_copilot') }, cb); - }, function(res, cb) { + }, function (res, cb) { if (res.isCopilotPosting.length > 0 && res.isCopilotPosting[0].challenge_is_copilot) { if (res.isCopilot.length === 0 || !res.isCopilot[0].user_is_copilot) { cb(new ForbiddenError('You should be a copilot before register a copilot posting.')); @@ -713,6 +676,7 @@ var registerSoftwareChallengeAction = function (api, connection, next) { connection, challengeId, "Submitter", //optional value. Here we don't need to provide such value. + true, connection.dbConnectionMap, cb ); @@ -763,6 +727,7 @@ var registerStudioChallengeAction = function (api, connection, next) { connection, challengeId, "Submitter", + true, connection.dbConnectionMap, cb ); diff --git a/actions/challengeUnregistration.js b/actions/challengeUnregistration.js new file mode 100755 index 000000000..5c9320b05 --- /dev/null +++ b/actions/challengeUnregistration.js @@ -0,0 +1,246 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * The APIs to un-register a challenge (studio category or software category) for the current logged-in user. + * + * @version 1.0 + * @author bugbuka + */ +"use strict"; + +var async = require('async'); +var _ = require('underscore'); +var moment = require('moment'); +var ForumWrapper = require("forum-connector").ForumWrapper; +var UnauthorizedError = require('../errors/UnauthorizedError'); +var NotFoundError = require('../errors/NotFoundError'); +var ForbiddenError = require('../errors/ForbiddenError'); + +//constants +var SUBMITTER_RESOURCE_ROLE_ID = 1, + PROJECT_USER_AUDIT_DELETE_TYPE = 2; + +/** + * Checks if specified challenge category ID implies the presence of records in project_result and component_inquiry + * tables for challenge registrants. + * + * @param {Number} categoryId - ID for challenge category. + * @returns {boolean} true if above records are required; false otherwise. + * @since 1.3 + */ +function isProjectResultCategory(categoryId) { + return (categoryId === 1 // Component Design + || categoryId === 2 // Component Development + || categoryId === 5 // Component Testing + || categoryId === 6 // Application Specification + || categoryId === 7 // Application Architecture + || categoryId === 9 // Bug Hunt + || categoryId === 13 // Test Scenarios + || categoryId === 26 // Test Suites + || categoryId === 14 // Application Assembly + || categoryId === 23 // Application Conceptualization + || categoryId === 19 // UI Prototype + || categoryId === 24 // RIA Build + || categoryId === 25 // RIA Component + || categoryId === 29 // Copilot Posting + || categoryId === 35 // Content Creation + || categoryId === 36 // Reporting + || categoryId === 38 // First2Finish + || categoryId === 39 // Code + ); +} + +/** + * Remove forum permissions. It is initialized only once. + * + * @param {Object} api The api object that is used to access the infrastructure. + * @param {Number} userId The current logged-in user's id. + * @param {Number} forumCategoryId The sql params. + * @param {Function} next The callback to be called after this function is done. + */ +var removeForumPermissions = function (api, userId, forumCategoryId, next) { + + if (api.config.general.grantForumAccess !== true || forumCategoryId === 0) { + next(); + return; + } + + if (forumCategoryId === null) { + api.log('Could not find forum category ' + forumCategoryId, 'error'); + next(new Error('Could not find forum category ' + forumCategoryId)); + return; + } + + api.log('start to remove user ' + userId + ' from forum category ' + forumCategoryId + '.'); + async.waterfall([ + function (cb) { + api.challengeHelper.getForumWrapper(api, cb); + }, function (forumWrapper, cb) { + forumWrapper.removeRole(userId, "Software_Users_" + forumCategoryId, cb); + }, function (forumWrapper, cb) { + forumWrapper.removeRole(userId, "Software_Moderators_" + forumCategoryId, cb); + }, function (forumWrapper, cb) { + forumWrapper.removeUserPermission(userId, forumCategoryId, cb); + }, function (forumWrapper, cb) { + forumWrapper.deleteCategoryWatch(userId, forumCategoryId, cb); + } + ], function (err) { + if (err) { + next(err); + return; + } + next(); + }); +}; + +/** + * Unregister a development (software) challenge for the current logged-in user. + * + * @param {Object} api The api object that is used to access the infrastructure. + * @param {Number} userId The current logged-in user's id. + * @param {Object} sqlParams The sql params. + * @param {Object} unregisterInfo The data used to do unregistration. + * @param {Object} dbConnectionMap The database connection map for the current request. + * @param {Function} next The callback to be called after this function is done. + */ +var unregisterChallenge = function (api, userId, sqlParams, unregisterInfo, dbConnectionMap, next) { + async.series([ + function (cb) { + if (sqlParams.isStudio || isProjectResultCategory(sqlParams.categoryId)) { + api.dataAccess.executeQuery("delete_challenge_result", sqlParams, dbConnectionMap, cb); + } else { + cb(); + } + + }, function (cb) { + + if (_.size(unregisterInfo.userChallengeResources) < 1) { + api.log("Could not find user challenge resource", 'error'); + cb(new Error('Could not find user challenge resource')); + return; + } + var submitterRoleResourceId = _.filter(unregisterInfo.userChallengeResources, function (resource) { + return resource.resource_role_id === SUBMITTER_RESOURCE_ROLE_ID; + })[0].resource_id; + + api.dataAccess.executeQuery("delete_challenge_resources", {resourceId : submitterRoleResourceId}, dbConnectionMap, cb); + }, function (cb) { + + api.challengeHelper.aduitResourceAddition(api, userId, sqlParams.challengeId, SUBMITTER_RESOURCE_ROLE_ID, PROJECT_USER_AUDIT_DELETE_TYPE, dbConnectionMap, cb); + }, function (cb) { + + if (_.size(unregisterInfo.userChallengeResources) === 1 && unregisterInfo.userChallengeResources[0].resource_role_id === SUBMITTER_RESOURCE_ROLE_ID) { // Only remove forum permissions if the user has no other roles left. + if (unregisterInfo.challengeForum.length === 0) { + api.log("Could not find user challenge forum", 'error'); + cb(new Error('Could not find user challenge forum')); + return; + } + var forumCategoryId = parseInt(unregisterInfo.challengeForum[0].forum_category_id, 10); + removeForumPermissions(api, userId, forumCategoryId, cb); + } + cb(); + } + ], next); +}; + +/** + * The action to unregister a challenge for the current logged-in user. + * + * @param {Object} api The api object that is used to access the infrastructure. + * @param {Object} connection The connection for the current request. + * @param {Function} next The callback to be called after this function is done. + */ +var unregisterChallengeAction = function (api, connection, next) { + + var helper = api.helper, + sqlParams = {}, + userId = connection.caller.userId, + challengeId = Number(connection.params.challengeId), + + execQuery = function (name) { + return function (cbx) { + api.dataAccess.executeQuery(name, sqlParams, connection.dbConnectionMap, cbx); + }; + }; + + async.waterfall([ + function (cb) { + + //Simple validations of the incoming parameters + var error = helper.checkPositiveInteger(challengeId, 'challengeId') || + helper.checkMaxInt(challengeId, 'challengeId') || + helper.checkMember(connection, 'You don\'t have the authority to access this. Please login.'); + + if (error) { + cb(error); + return; + } + + //Check if the user passes validations for joining the challenge + sqlParams.userId = userId; + sqlParams.challengeId = challengeId; + + api.dataAccess.executeQuery("challenge_unregistration_validations", sqlParams, connection.dbConnectionMap, cb); + }, function (rows, cb) { + if (rows.length === 0) { + + cb(new NotFoundError('No such challenge exists.')); + } else if (!rows[0].reg_open) { + + cb(new ForbiddenError('You cannot unregister since registration phase is closed.')); + } else if (!rows[0].user_has_submitter_resource_role) { + + cb(new ForbiddenError('You are not registered for this challenge.')); + } + + sqlParams.categoryId = rows[0].category_id; + sqlParams.isStudio = rows[0].is_studio; + + async.series({ + userChallengeResources: execQuery('get_user_challenge_resource'), + challengeForum: execQuery('get_challenge_forum') + }, cb); + + }, + function (result, cb) { + unregisterChallenge(api, userId, sqlParams, result, connection.dbConnectionMap, cb); + } + ], function (err) { + if (err) { + api.helper.handleError(api, connection, err); + } else { + api.log("unregister the challenge succeeded.", 'debug'); + connection.response = {message : "ok"}; + } + next(connection, true); + }); + +}; + +/** + * The API to unregister a challenge for the current logged-in user. + */ +exports.unregisterChallenge = { + name: "unregisterChallenge", + description: "unregisterChallenge", + inputs: { + required: ["challengeId"], + optional: [] + }, + blockedConnectionTypes: [], + outputExample: {}, + version: 'v2', + cacheEnabled : false, + transaction: 'write', + databases: ["tcs_catalog"], + run: function (api, connection, next) { + if (connection.dbConnectionMap) { + api.log("Execute unregisterChallenge#run", 'debug'); + unregisterChallengeAction(api, connection, next); + } else { + api.helper.handleNoConnection(api, connection, next); + } + } +}; + + diff --git a/actions/challenges.js b/actions/challenges.js index f4e8e94b6..95000b3e8 100755 --- a/actions/challenges.js +++ b/actions/challenges.js @@ -1,7 +1,7 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.18 + * @version 1.20 * @author Sky_, mekanizumu, TCSASSEMBLER, freegod, Ghost_141, kurtrips, xjtufreeman, ecnu_haozi, hesibo, LazyChild * @changes from 1.0 * merged with Member Registration API @@ -44,6 +44,10 @@ * add API for submitting to design challenge * changes in 1.18: * add clientSelection flag in studio results + * changes in 1.19: + * add new allowed sort columns. + * changes in 1.20: + * add get challenge detail api for both design and develop challenge. */ "use strict"; /*jslint stupid: true, unparam: true, continue: true */ @@ -90,19 +94,10 @@ var ALLOWABLE_QUERY_PARAMETER = [ */ var ALLOWABLE_SORT_COLUMN = [ "challengeName", "challengeType", "challengeId", "cmcTaskId", "registrationEndDate", - "submissionEndDate", "finalFixEndDate", "prize1", "currentStatus", "digitalRunPoints" + "submissionEndDate", "finalFixEndDate", "prize1", "currentStatus", "digitalRunPoints", + "postingDate", "numSubmissions", "numRegistrants", "currentPhaseRemainingTime", "currentPhaseName", "registrationOpen" ]; -/** - * Represents a ListType enum - */ -var ListType = { ACTIVE: "ACTIVE", OPEN: "OPEN", UPCOMING: "UPCOMING", PAST: "PAST" }; - -/** - * Represents a predefined list of valid list type. - */ -var ALLOWABLE_LIST_TYPE = [ListType.ACTIVE, ListType.OPEN, ListType.UPCOMING, ListType.PAST]; - /** * Represents Percentage of Placement Points for digital run */ @@ -113,24 +108,6 @@ var DR_POINT = [[1], [0.7, 0.3], [0.65, 0.25, 0.10], [0.6, 0.22, 0.1, 0.08], [0. */ var MAX_INT = 2147483647; -/** - * The list type and registration phase status map. - */ -var LIST_TYPE_REGISTRATION_STATUS_MAP = {}; -LIST_TYPE_REGISTRATION_STATUS_MAP[ListType.ACTIVE] = [2, 3]; -LIST_TYPE_REGISTRATION_STATUS_MAP[ListType.OPEN] = [2]; -LIST_TYPE_REGISTRATION_STATUS_MAP[ListType.UPCOMING] = [1]; -LIST_TYPE_REGISTRATION_STATUS_MAP[ListType.PAST] = [3]; - -/** - * The list type and project status map. - */ -var LIST_TYPE_PROJECT_STATUS_MAP = {}; -LIST_TYPE_PROJECT_STATUS_MAP[ListType.ACTIVE] = [1]; -LIST_TYPE_PROJECT_STATUS_MAP[ListType.OPEN] = [1]; -LIST_TYPE_PROJECT_STATUS_MAP[ListType.UPCOMING] = [2]; -LIST_TYPE_PROJECT_STATUS_MAP[ListType.PAST] = [4, 5, 6, 7, 8, 9, 10, 11]; - /** * This copilot posting project type id */ @@ -202,7 +179,7 @@ function validateInputParameter(helper, caller, challengeType, query, filter, pa helper.checkPositiveInteger(pageSize, "pageSize") || helper.checkMaxNumber(pageSize, MAX_INT, 'pageSize') || helper.checkMaxNumber(pageIndex, MAX_INT, 'pageIndex') || - helper.checkContains(ALLOWABLE_LIST_TYPE, type.toUpperCase(), "type") || + helper.checkContains(helper.VALID_LIST_TYPE, type.toUpperCase(), "type") || checkQueryParameterAndSortColumn(helper, type, query, sortColumn); if (_.isDefined(query.communityId)) { @@ -357,7 +334,8 @@ function transferResult(src, helper) { digitalRunPoints: row.digital_run_points, prize: [], reliabilityBonus: helper.getReliabilityBonus(row.prize1), - challengeCommunity: row.is_studio ? 'design' : 'develop' + challengeCommunity: row.is_studio ? 'design' : 'develop', + registrationOpen: row.registration_open }); for (i = 1; i < 10; i = i + 1) { @@ -474,7 +452,7 @@ var searchChallenges = function (api, connection, dbConnectionMap, community, ne sortOrder = query.sortorder || "asc"; sortColumn = query.sortcolumn || DEFAULT_SORT_COLUMN; - listType = (query.listtype || ListType.OPEN).toUpperCase(); + listType = (query.listtype || helper.ListType.OPEN).toUpperCase(); pageIndex = Number(query.pageindex || 1); pageSize = Number(query.pagesize || 50); @@ -502,8 +480,8 @@ var searchChallenges = function (api, connection, dbConnectionMap, community, ne // Set the project type id sqlParams.project_type_id = challengeType.category; // Set the submission phase status id. - sqlParams.registration_phase_status = LIST_TYPE_REGISTRATION_STATUS_MAP[listType]; - sqlParams.project_status_id = LIST_TYPE_PROJECT_STATUS_MAP[listType]; + sqlParams.registration_phase_status = helper.LIST_TYPE_REGISTRATION_STATUS_MAP[listType]; + sqlParams.project_status_id = helper.LIST_TYPE_PROJECT_STATUS_MAP[listType]; sqlParams.userId = caller.userId || 0; // Check the private challenge access @@ -579,14 +557,14 @@ var getChallenge = function (api, connection, dbConnectionMap, isStudio, next) { caller = connection.caller; async.waterfall([ function (cb) { - error = helper.checkPositiveInteger(Number(connection.params.contestId), 'contestId') || - helper.checkMaxNumber(Number(connection.params.contestId), MAX_INT, 'contestId'); + error = helper.checkPositiveInteger(Number(connection.params.challengeId), 'challengeId') || + helper.checkMaxNumber(Number(connection.params.challengeId), MAX_INT, 'challengeId'); if (error) { cb(error); return; } sqlParams = { - challengeId: connection.params.contestId, + challengeId: connection.params.challengeId, project_type_id: challengeType.category, user_id: caller.userId || 0 }; @@ -782,6 +760,10 @@ var getChallenge = function (api, connection, dbConnectionMap, isStudio, next) { submissionEndDate : formatDate(data.submission_end_date) }; + if (connection.action === "getChallenge") { + challenge.type = isStudio ? 'design' : 'develop'; + } + if (data.project_type === COPILOT_POSTING_PROJECT_TYPE && (isCopilot || helper.isAdmin(caller))) { challenge.copilotDetailedRequirements = data.copilot_detailed_requirements; } @@ -864,7 +846,8 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next ret = {}, userId = connection.caller.userId, challengeId = Number(connection.params.challengeId), - fileName, + fileName = connection.params.fileName, + fileData = connection.params.fileData, type = connection.params.type, error, resourceId, @@ -879,8 +862,7 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next thurgoodApiKey = process.env.THURGOOD_API_KEY || api.config.thurgoodApiKey, thurgoodJobId = null, multipleSubmissionPossible, - savedFilePath = null, - submissionFile = connection.params.submissionFile; + savedFilePath = null; async.waterfall([ function (cb) { @@ -893,7 +875,9 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next //Simple validations of the incoming parameters error = helper.checkPositiveInteger(challengeId, 'challengeId') || - helper.checkMaxNumber(challengeId, MAX_INT, 'challengeId'); + helper.checkMaxNumber(challengeId, MAX_INT, 'challengeId') || + helper.checkStringPopulated(fileName, 'fileName') || + helper.checkStringPopulated(fileData, 'fileData'); if (error) { cb(error); @@ -911,15 +895,7 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next } } - //Simple validations of the incoming parameters - if (submissionFile.constructor.name !== 'File') { - cb(new IllegalArgumentError("submissionFile must be a File")); - return; - } - - //Validation for the size of the fileName parameter. It should be 256 chars as this is max length of parameter field in submission table. - fileName = submissionFile.name; if (fileName.length > 256) { cb(new BadRequestError("The file name is too long. It must be 256 characters or less.")); return; @@ -988,37 +964,53 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next uploadId = generatedIds.uploadId; submissionId = generatedIds.submissionId; - var submissionPath; + var submissionPath, + filePathToSave, + decodedFileData; //The file output dir should be overwritable by environment variable submissionPath = api.config.submissionDir; //The path to save is the folder with the name as //The name of the file is the _ - savedFilePath = submissionPath + "/" + uploadId + "_" + fileName; - - //Check the max length of the submission file (if there is a limit) - if (api.config.submissionMaxSizeBytes > 0) { - fs.stat(submissionFile.path, function (err, stats) { - if (err) { - cb(err); - return; - } + filePathToSave = submissionPath + "/" + uploadId + "_" + connection.params.fileName; - if (stats.size > api.config.submissionMaxSizeBytes) { - cb(new RequestTooLargeError( - "The submission file size is greater than the max allowed size: " + (api.config.submissionMaxSizeBytes / 1024) + " KB." - )); - return; - } + //Decode the base64 encoded file data + decodedFileData = new Buffer(connection.params.fileData, 'base64'); + + //Write the submission to file + fs.writeFile(filePathToSave, decodedFileData, function (err) { + if (err) { + cb(err); + return; + } + + //Check the max length of the submission file (if there is a limit) + if (api.config.submissionMaxSizeBytes > 0) { + fs.stat(filePathToSave, function (err, stats) { + if (err) { + cb(err); + return; + } + console.log('-------------------------------------------'); + console.log(stats.size + '\t' + api.config.submissionMaxSizeBytes); + console.log('-------------------------------------------'); + + if (stats.size > api.config.submissionMaxSizeBytes) { + cb(new RequestTooLargeError( + "The submission file size is greater than the max allowed size: " + (api.config.submissionMaxSizeBytes / 1024) + " KB." + )); + return; + } + savedFilePath = filePathToSave; + cb(); + }); + } else { + savedFilePath = filePathToSave; cb(); - }); - } else { - cb(); - } + } + }); }, function (cb) { - fs.createReadStream(submissionFile.path).pipe(fs.createWriteStream(savedFilePath)); - //Now insert into upload table _.extend(sqlParams, { uploadId: uploadId, @@ -1026,7 +1018,7 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next challengeId: challengeId, projectPhaseId: type === 'final' ? submissionPhaseId : checkpointSubmissionPhaseId, resourceId: resourceId, - fileName: fileName + fileName: uploadId + "_" + fileName }); api.dataAccess.executeQuery("insert_upload", sqlParams, dbConnectionMap, cb); }, function (notUsed, cb) { @@ -1259,6 +1251,7 @@ exports.getChallengeTerms = { connection, challengeId, role, + true, connection.dbConnectionMap, cb ); @@ -1458,7 +1451,7 @@ exports.getSoftwareChallenge = { name: "getSoftwareChallenge", description: "getSoftwareChallenge", inputs: { - required: ["contestId"], + required: ["challengeId"], optional: ["refresh"] }, blockedConnectionTypes: [], @@ -1483,7 +1476,7 @@ exports.getStudioChallenge = { name: "getStudioChallenge", description: "getStudioChallenge", inputs: { - required: ["contestId"], + required: ["challengeId"], optional: ["refresh"] }, blockedConnectionTypes: [], @@ -1501,6 +1494,44 @@ exports.getStudioChallenge = { } }; +/** + * The API for getting challenge details. + * + * @since 1.19 + */ +exports.getChallenge = { + name: "getChallenge", + description: "getStudioChallenge", + inputs: { + required: ["challengeId"], + optional: ["refresh"] + }, + blockedConnectionTypes: [], + outputExample: {}, + version: 'v2', + transaction: 'read', // this action is read-only + databases: ["tcs_catalog", "tcs_dw"], + run: function (api, connection, next) { + if (connection.dbConnectionMap) { + api.log("Execute getChallenge#run", 'debug'); + api.dataAccess.executeQuery('check_challenge_exists', {challengeId: connection.params.challengeId}, connection.dbConnectionMap, function (err, result) { + if (err) { + api.helper.handleError(api, connection, err); + next(connection, true); + } else if (result.length === 0) { + api.helper.handleError(api, connection, new NotFoundError("Challenge not found.")); + next(connection, true); + } else { + var isStudio = Boolean(result[0].is_studio); + getChallenge(api, connection, connection.dbConnectionMap, isStudio, next); + } + }); + } else { + api.helper.handleNoConnection(api, connection, next); + } + } +}; + /** * The API for searching challenges */ @@ -1609,7 +1640,7 @@ exports.submitForDevelopChallenge = { name: "submitForDevelopChallenge", description: "submitForDevelopChallenge", inputs: { - required: ["challengeId", "submissionFile"], + required: ["challengeId", "fileName", "fileData"], optional: ["type"] }, blockedConnectionTypes: [], @@ -1713,7 +1744,7 @@ var DEFAULT_FONT_URL = 'community.topcoder.com/studio/the-process/font-policy/'; * Gets the file type based on the file name extension. Return null if not found. * @since 1.14 * - * @param {Object} file - The file name + * @param {Object} fileName - The file name * @param {Object} fileTypes - The file types from which to read */ var getFileType = function (fileName, fileTypes) { diff --git a/actions/docusign.js b/actions/docusign.js index 2b9a43e82..d7c809003 100644 --- a/actions/docusign.js +++ b/actions/docusign.js @@ -5,19 +5,248 @@ * @author TCSASSEMBLER */ "use strict"; +/*jslint unparam: true */ -var async = require('async'); -var _ = require('underscore'); +var _ = require("underscore"); +var async = require("async"); +var S = require("string"); +var config = require("../config").config; var request = require('request'); var NotFoundError = require('../errors/NotFoundError'); var IllegalArgumentError = require('../errors/IllegalArgumentError'); var UnauthorizedError = require('../errors/UnauthorizedError'); +/** + * The TermsOfUse Handler + * Note that just like the Java code, it can be reused for different templates and termsOfUseId + * The contrcutor takes the termsOfUseId during initialization + */ +function TermsOfUseHandler(termsOfUseId) { + this.termsOfUseId = termsOfUseId; +} +TermsOfUseHandler.prototype.termsOfUseId = 0; +/** + * The function that actually handles the document + * All future document handlers must also follow the same method signature as used here (akin to a Java interface) + * @param userId The user for which to handle the document + * @param tabs Arrays of objects which have tabLabel and tabValue parameters. + * This is actually not used here but is needed because the method signature needs to consistent for all document handlers + * @param api The actionhero api object + * @param dbConnectionMap The DB connection map + * @param done The callback to call once done. It will be called with argument if there is error, otherwise will be called without argument. + * The argument must have a message property. If the error is temporary, then it should also have a temporary property set to true. + */ +TermsOfUseHandler.prototype.handleDocument = function (userId, tabs, api, dbConnectionMap, done) { + var sqlParams = { + termsOfUseId: this.termsOfUseId, + userId: userId + }; + async.waterfall([ + function (cb) { + api.dataAccess.executeQuery("get_terms_of_use", sqlParams, dbConnectionMap, cb); + }, function (rows, cb) { + if (rows.length === 0) { + done({ + message: "No terms of use exists for id: " + sqlParams.termsOfUseId, + }); + return; + } + api.dataAccess.executeQuery("check_user_terms_of_use_ban", sqlParams, dbConnectionMap, cb); + }, function (rows, cb) { + if (rows.length !== 0) { + api.log("User with id: " + userId + " is not allowed to accept terms of use with id: " + sqlParams.termsOfUseId, 'error'); + done(); + return; + } + api.dataAccess.executeQuery("check_user_terms_of_use_exist", sqlParams, dbConnectionMap, cb); + }, function (rows, cb) { + if (rows.length !== 0) { + api.log("User with id: " + userId + " has already accepted terms of use with id: " + sqlParams.termsOfUseId, 'warn'); + done(); + return; + } + api.dataAccess.executeQuery("insert_user_terms_of_use", sqlParams, dbConnectionMap, cb); + }, function (notUsed, cb) { + cb(); + } + ], function (err) { + if (err) { + //If we have an error here, it is because of unexpected error (like DB connection died) + //So this needs to be considered a temporary failure, so that Docusign Connect can call us again later + done({ + message: "Unable to process terms of use. Try again later.", + temporary: true + }); + } else { + done(); + } + }); +}; + + +/** + * Contains the template name, id and the handlers for the template + * Note that there can be more than 1 handlers per template + * Handlers that are not required for this contest are left empty + */ +var templates = [{ + name: 'W9', + templateId: config.docusign.w9TemplateId, + handlers: [] +}, { + name: 'W-8BEN', + templateId: config.docusign.w8benTemplateId, + handlers: [] +}, { + name: 'TopCoder Assignment v2.0', + templateId: config.docusign.assignmentV2TemplateId, + handlers: [ + new TermsOfUseHandler(config.docusign.assignmentDocTermsOfUseId) + ] +}, { + name: 'Appirio Mutual NDA', + templateId: config.docusign.appirioMutualNDATemplateId, + handlers: [] +}, { + name: 'Affidavit', + templateId: config.docusign.affidavitTemplateId, + handlers: [] +}]; + +/** + * Convenience function that writes the response and calls the actionhero next + * @param connection actionhero connection + * @param statusCode the status code to write + * @param next The actionhero next callback + * @param message If exists then this message is set to body, otherwise body is simply 'success' + */ +function writeResponse(connection, statusCode, next, message) { + connection.rawConnection.responseHttpCode = statusCode; + connection.response = { + message: message || 'success' + }; + next(connection, true); +} + +/** + * The error to throw if connect key is missing or invalid + */ +var CONNECT_KEY_MISSING = 'Connect Key is missing or invalid.'; + +/** + * The Docusign Callback Action which accepts JSON. + * Performs the logic common to all Docusign documents. + */ +exports.docusignCallback = { + name: 'docusignCallback', + description: 'docusignCallback', + blockedConnectionTypes: [], + outputExample: {}, + version: 'v2', + transaction : 'write', + cacheEnabled : false, + databases : ["informixoltp", "common_oltp"], + inputs: { + required: ['envelopeStatus', 'envelopeId', 'tabs', 'connectKey'], + optional: [], + }, + run: function (api, connection, next) { + api.log("Execute docusignCallback#run", 'debug'); + var dbConnectionMap = connection.dbConnectionMap, + envelopeStatus = connection.params.envelopeStatus, + envelopeId = connection.params.envelopeId, + connectKey = connection.params.connectKey, + tabs = connection.params.tabs, + sqlParams = {}, + envelopeInfo; + + async.waterfall([ + function (cb) { + if (connectKey !== config.docusign.callbackConnectKey) { + api.log(CONNECT_KEY_MISSING, 'error'); + writeResponse(connection, 404, next, CONNECT_KEY_MISSING); + return; + } + + if (envelopeStatus !== 'Completed') { + api.log('Status is not completed.', 'info'); + writeResponse(connection, 200, next); + return; + } + + if (new S(envelopeId).isEmpty()) { + api.log('envelopeId is null or empty', 'error'); + writeResponse(connection, 200, next); + return; + } + + //Set completed = 1 for the envelope id + sqlParams.envelopeId = envelopeId; + api.dataAccess.executeQuery("complete_docusign_envelope", sqlParams, dbConnectionMap, cb); + }, function (updatedCount, cb) { + //updatedCount is the number of rows that were updated. + if (updatedCount === 1) { + //Get the docusign data (we need the templateId) for the envelope + api.dataAccess.executeQuery("get_docusign_envelope_by_envelope_id", sqlParams, dbConnectionMap, cb); + } else { + api.log('No enevelope with id: ' + envelopeId + ' was found.', 'error'); + writeResponse(connection, 200, next); + return; + } + }, function (rows, cb) { + envelopeInfo = rows[0]; + + //Find the template for the envelope + var template = _.findWhere(templates, {templateId: envelopeInfo.docusign_template_id}); + if (template === undefined) { + api.log('No Template was found for template id: ' + envelopeInfo.docusign_template_id, 'warn'); + writeResponse(connection, 200, next); + return; + } + + //Call the handlers for the template, one after the other + async.eachSeries(template.handlers, function (handler, cbx) { + handler.handleDocument(envelopeInfo.user_id, tabs, api, dbConnectionMap, cbx); + }, function (err) { + if (err) { + cb(err); + return; + } + cb(); + }); + } + ], function (err) { + if (err) { + //All errors need to be communicated to the support staff + api.tasks.enqueue("sendEmail", { + subject : config.docusign.callbackFailedEmailSubject, + template : 'docusign_callback_failure_email', + toAddress : config.docusign.supportEmailAddress, + fromAddress : config.docusign.fromEmailAddress, + userId : envelopeInfo.user_id, + templateId: envelopeInfo.docusign_template_id, + envelopeId : envelopeInfo.docusign_envelope_id, + message : err.message + }, 'default'); + + //Only temporary errors are to return 500, otherwise 200 + if (err.temporary === true) { + writeResponse(connection, 500, next, err.message); + } else { + writeResponse(connection, 200, next, err.message); + } + } else { + writeResponse(connection, 200, next); + } + }); + } +}; + /** * Creates the options object used for making an HTTP request. * Sets the HTTP method, url, body and the Docusign Authorization header - * @param api The infrastructure api object from which we read the configuration + * @param api The api object from which to read configuration * @param url The url to set for the HTTP request * @param method The verb to set for the HTTP request * @param body The body to set for the HTTP request in case method is POST. It must be a String not an Object. @@ -42,7 +271,7 @@ function initializeRequest(api, url, method, body) { /** * The method that exposes the Get Docusign Recipient View URL API. */ -exports.action = { +exports.generateDocusignViewURL = { name: 'generateDocusignViewURL', description: 'generateDocusignViewURL', blockedConnectionTypes: [], @@ -74,7 +303,7 @@ exports.action = { api.log("Executing getDocusignViewURL#run", 'debug'); async.waterfall([ function (cb) { - var x, spl, u; + var x, spl; //Check if the templateId is valid if (!templateId.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i)) { @@ -106,9 +335,14 @@ exports.action = { //Perform login to docusign - options = initializeRequest(api, api.config.docusign.serverURL + "login_information", 'GET', ''); + options = initializeRequest(api, config.docusign.serverURL + "login_information", 'GET', ''); request(options, function (err, res, body) { - var resp = JSON.parse(body); + var resp; + try { + resp = JSON.parse(body); + } catch (e) { + err = 'Invalid JSON received from server. Most likely the server url is incorrect.'; + } if (err || (res.statusCode !== 200 && res.statusCode !== 201)) { //In case of system integration failure, we log the error (if we have one)... //but we only show generic message to end user @@ -167,7 +401,12 @@ exports.action = { url = baseURL + "/envelopes"; options = initializeRequest(api, url, 'POST', JSON.stringify(reqParams)); request(options, function (err, res, body) { - var resp = JSON.parse(body); + var resp; + try { + resp = JSON.parse(body); + } catch (e) { + err = 'Invalid JSON received from server. Most likely the server url is incorrect.'; + } if (err || (res.statusCode !== 200 && res.statusCode !== 201)) { //This is client's fault that they sent in a wrong template id if (resp && resp.errorCode && resp.errorCode === 'TEMPLATE_ID_INVALID') { @@ -185,14 +424,13 @@ exports.action = { //persist the new envelope to database sqlParams.envelopeId = resp.envelopeId; sqlParams.complete = 0; - api.dataAccess.executeQuery( - 'insert_docusign_envelope', sqlParams, dbConnectionMap, function (err) { - if (err) { - cb(err); - return; - } - cb(null, resp.envelopeId); - }); + api.dataAccess.executeQuery('insert_docusign_envelope', sqlParams, dbConnectionMap, function (err) { + if (err) { + cb(err); + return; + } + cb(null, resp.envelopeId); + }); }); } else { //The envelope already exists @@ -216,7 +454,12 @@ exports.action = { }; options = initializeRequest(api, url, 'POST', JSON.stringify(reqParams)); request(options, function (err, res, body) { - var resp = JSON.parse(body); + var resp; + try { + resp = JSON.parse(body); + } catch (e) { + err = 'Invalid JSON received from server. Most likely the server url is incorrect.'; + } if (err || (res.statusCode !== 200 && res.statusCode !== 201)) { //In case of system integration failure, we log error, but we only show generic message to user if (resp && resp.message) { diff --git a/actions/download.js b/actions/download.js index ad347fb57..fb70e2c95 100644 --- a/actions/download.js +++ b/actions/download.js @@ -573,7 +573,7 @@ var downloadDesignSubmission = function (api, connection, dbConnectionMap, next) noRights = false; } - //Screener can download submission if screening has started + //Screener can download submission if screening has started if (_.intersection(myResourceRoleIds, screenerRoles).length > 0 && basicInfo[0].is_at_or_after_screening) { noRights = false; } @@ -595,9 +595,9 @@ var downloadDesignSubmission = function (api, connection, dbConnectionMap, next) } } - //managers can download the submissions anytime + //managers can download the submissions anytime if (noRights && isManager) { - noRights = false; + noRights = false; } //everyone - can download previews and watermarks after review and if submissions are viewable diff --git a/actions/marathonChallenges.js b/actions/marathonChallenges.js index 6569e8ae7..665ab3614 100644 --- a/actions/marathonChallenges.js +++ b/actions/marathonChallenges.js @@ -1,14 +1,17 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.3 - * @author Sky_, TCSASSEMBLER, freegod, Ghost_141 + * @version 1.4 + * @author Sky_, TCSASSEMBLER, freegod, Ghost_141, hesibo * changes in 1.1: * - implement marathon API * changes in 1.2: * - Use empty result set instead of 404 error in get marathon challenges API. * Changes in 1.3: * - Implement the register marathon match challenge API. + * changes in 1.4: + * - Implement the get marathon match challenge register info API + * - refactor register marathon match challenge API */ "use strict"; var async = require('async'); @@ -104,8 +107,8 @@ function setDateToParams(helper, sqlParams, dateInterval, inputCodePrefix) { } /** -* The API for searching Marathon challenges -*/ + * The API for searching Marathon challenges + */ exports.searchMarathonChallenges = { name: "searchMarathonChallenges", description: "searchMarathonChallenges", @@ -294,7 +297,7 @@ exports.searchMarathonChallenges = { /** * Compute progressResources field for challenge details - * + * * @param {Array} submissions - the submissions. Result of detail_progress_XXX query. * @param {Array} registrants - the registrants. Result of detail_progress_XXX_registrants query. * @param {Array} competitors - the competitors. Result of detail_progress_competitors query. @@ -398,8 +401,8 @@ function computeProgressResources(submissions, registrants, competitors, interva } /** -* The API for getting Marathon challenge -*/ + * The API for getting Marathon challenge + */ exports.getMarathonChallenge = { name: "getMarathonChallenge", description: "getMarathonChallenge", @@ -515,35 +518,36 @@ exports.getMarathonChallenge = { }); } }; - /** - * Register the marathon match challenge. - * @param {Object} api - the api object. - * @param {Object} connection - the connection object. - * @param {Function} next - the callback function. - * @since 1.3 + * perform checking before register marathon or view register info + * + * @param {Object} api - the api object + * @param {Boolean} isRegister - it is register marathon or not + * @param {Object} connection - the connection object + * @param {Object} sqlParams - the sql parameters object + * @param {Function} callback - the callback function + * + * @since 1.4 */ -function registerMarathonMatchChallenge(api, connection, next) { - var helper = api.helper, dbConnectionMap = connection.dbConnectionMap, roundId, sqlParams, isHighSchool, +function preRegisterMarathonCheck(api, isRegister, connection, sqlParams, callback) { + var dbConnectionMap = connection.dbConnectionMap, + roundId = Number(decodeURI(connection.params.roundId).trim()), execQuery = function (name) { return function (cb) { api.dataAccess.executeQuery(name, sqlParams, dbConnectionMap, cb); }; - }, caller = connection.caller; - roundId = Number(decodeURI(connection.params.roundId).trim()); + }; async.waterfall([ function (cb) { - var error = helper.checkPositiveInteger(roundId, 'roundId') || - helper.checkMaxInt(roundId, 'roundId') || - helper.checkMember(connection, 'Authorization information needed or incorrect.'); + var error = api.helper.checkPositiveInteger(roundId, 'roundId') || + api.helper.checkMaxInt(roundId, 'roundId') || + api.helper.checkMember(connection, 'Authorization information needed or incorrect.'); if (error) { cb(error); return; } - sqlParams = { - round_id: roundId, - user_id: caller.userId - }; + sqlParams.round_id = roundId; + sqlParams.user_id = connection.caller.userId; // check async.parallel({ checkResult: execQuery('check_marathon_challenge_register'), @@ -588,7 +592,7 @@ function registerMarathonMatchChallenge(api, connection, next) { } } // If the caller has already reigstered for this challenge. - if (checkResult.is_round_registered) { + if (isRegister && checkResult.is_round_registered) { cb(new BadRequestError('You already registered for this challenge.')); return; } @@ -619,10 +623,39 @@ function registerMarathonMatchChallenge(api, connection, next) { cb(new BadRequestError('There are no more spots available for the round.')); return; } + cb(null, checkResult); + } + ], function (err, checkResult) { + if (isRegister) { + callback(err, checkResult); + } else { + callback(err); + } + }); +} +/** + * Register the marathon match challenge. + * @param {Object} api - the api object. + * @param {Object} connection - the connection object. + * @param {Function} next - the callback function. + * @since 1.3 + */ +function registerMarathonMatchChallenge(api, connection, next) { + var sqlParams = {}, + execQuery = function (name) { + return function (cb) { + api.dataAccess.executeQuery(name, sqlParams, connection.dbConnectionMap, cb); + }; + }; + async.waterfall([ + function (cb) { + preRegisterMarathonCheck(api, true, connection, sqlParams, cb); + }, + function (checkResult, cb) { _.extend(sqlParams, { eligible: 1, - userId: caller.userId, + userId: connection.caller.userId, attended: 'N' }); async.parallel({ @@ -630,7 +663,7 @@ function registerMarathonMatchChallenge(api, connection, next) { roundTerms: execQuery('insert_round_terms_acceptance'), algoRating: function (cbx) { if (!checkResult.is_rated) { - api.dataAccess.executeQuery('add_algo_rating', sqlParams, dbConnectionMap, cbx); + api.dataAccess.executeQuery('add_algo_rating', sqlParams, connection.dbConnectionMap, cbx); return; } cbx(); @@ -642,7 +675,7 @@ function registerMarathonMatchChallenge(api, connection, next) { } ], function (err) { if (err) { - helper.handleError(api, connection, err); + api.helper.handleError(api, connection, err); } else { connection.response = { success: true }; } @@ -677,3 +710,103 @@ exports.registerMarathonChallenge = { } } }; + +/** + * Get marathon match challenge register information. + * + * @param {Object} api - the api object. + * @param {Object} connection - the connection object. + * @param {Function} next - the callback function. + * + * @since 1.4 + */ +function getMarathonChallengeRegInfo(api, connection, next) { + var sqlParams = {}, result = {}, questionIdMapping = {}, index = 0; + async.waterfall([ + function (cb) { + preRegisterMarathonCheck(api, false, connection, sqlParams, cb); + }, + function (cb) { + api.dataAccess.executeQuery('get_marathon_round_term', sqlParams, connection.dbConnectionMap, cb); + }, + function (term, cb) { + if (term.length === 0) { + cb(new NotFoundError('Could not find specified round terms.')); + return; + } + result.term = { + contestName: term[0].contest_name, + roundName: term[0].round_name, + termsContent: term[0].terms_content || '' + }; + api.dataAccess.executeQuery('get_marathon_round_questions', sqlParams, connection.dbConnectionMap, cb); + }, + function (questions, cb) { + sqlParams.question_ids = []; + result.questions = _.map(questions, function (question) { + sqlParams.question_ids.push(question.question_id); + questionIdMapping[question.question_id] = index; + index = index + 1; + return { + id: question.question_id, + style: question.style, + type: question.type, + text: question.text, + answers: [] + }; + }); + if (!_.isEmpty(sqlParams.question_ids)) { + api.dataAccess.executeQuery('get_marathon_round_question_answers', sqlParams, connection.dbConnectionMap, cb); + } else { + cb(null, null); + } + }, + function (answers, cb) { + if (!_.isEmpty(sqlParams.question_ids)) { + answers.forEach(function (answer) { + result.questions[questionIdMapping[answer.question_id]].answers.push({ + id: answer.answer_id, + text: answer.text, + sortOrder: answer.sort_order || -1, + correct: answer.correct === 0 ? false : true + }); + }); + } + cb(); + } + ], function (err) { + if (err) { + api.helper.handleError(api, connection, err); + } else { + connection.response = result; + } + next(connection, true); + }); +} + +/** + * The API for get marathon match challenge register information. + * + * @since 1.4 + */ +exports.getMarathonChallengeRegInfo = { + name: 'getMarathonChallengeRegInfo', + description: 'get marathon match challenge register information', + inputs: { + required: ['roundId'], + optional: [] + }, + blockedConnectionTypes: [], + outputExample: {}, + version: 'v2', + transaction: 'read', // this action is read-only + databases: ['informixoltp', 'common_oltp'], + run: function (api, connection, next) { + if (!connection.dbConnectionMap) { + api.helper.handleNoConnection(api, connection, next); + } else { + api.log('Execute getMarathonChallengeRegInfo#run', 'debug'); + getMarathonChallengeRegInfo(api, connection, next); + } + } +}; diff --git a/actions/memberRegistration.js b/actions/memberRegistration.js index 8e3a81291..47a90b63d 100644 --- a/actions/memberRegistration.js +++ b/actions/memberRegistration.js @@ -129,8 +129,7 @@ function codeRandom(coderId) { } while (oldseed.toNumber() === nextseed.toNumber()); cr.seed = nextseed; return nextseed.shiftRight(16).toNumber(); - } - + }; return cr; } @@ -190,7 +189,10 @@ function getCode(coderId) { * @param {Function} next - The callback function */ var registerUser = function (user, api, dbConnectionMap, next) { - var activationCode; + var activationCode, + utm_source = user.utm_source || '', + utm_medium = user.utm_medium || '', + utm_campaign = user.utm_campaign || ''; // Get the next user id api.idGenerator.getNextID("USER_SEQ", dbConnectionMap, function (err, result) { if (err) { @@ -205,7 +207,18 @@ var registerUser = function (user, api, dbConnectionMap, next) { var regSource = user.regSource !== null && user.regSource !== undefined ? user.regSource : 'api'; // use user id as activation code for now activationCode = getCode(user.id); - api.dataAccess.executeQuery("insert_user", {userId : user.id, firstName : user.firstName, lastName : user.lastName, handle : user.handle, status : status, activationCode : activationCode, regSource : regSource}, dbConnectionMap, function (err, result) { + api.dataAccess.executeQuery("insert_user", { + userId : user.id, + firstName : user.firstName, + lastName : user.lastName, + handle : user.handle, + status : status, + activationCode : activationCode, + regSource : regSource, + utm_source : utm_source, + utm_medium : utm_medium, + utm_campaign : utm_campaign}, + dbConnectionMap, function (err, result) { callback(err, result); }); }, @@ -955,7 +968,7 @@ exports.memberRegister = { description: "Register a new member", inputs: { required: ["firstName", "lastName", "handle", "country", "email"], - optional: ["password", "socialProviderId", "socialUserName", "socialEmail", "socialEmailVerified", "regSource", "socialUserId"] + optional: ["password", "socialProviderId", "socialUserName", "socialEmail", "socialEmailVerified", "regSource", "socialUserId", "utm_source", "utm_medium", "utm_campaign"] }, blockedConnectionTypes : [], outputExample : {}, diff --git a/actions/memberStatistics.js b/actions/memberStatistics.js index 7b0b97bdc..c93fd700c 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'); @@ -116,7 +118,27 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa sqlParams = { handle: handle }, - result; + result, + loadData, + requestedData, + parts; + + // check for an optional data query string param than enables loading a subset of data + 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 + 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) { @@ -139,103 +161,101 @@ 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], + ratingSummary, + achievements, + emails, + appendIfNotEmpty, + privateInfo, + address; + + 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) { + 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) { + 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) { + emails = []; + results.emails.forEach(function (item) { + emails.push({ + email: item.email, + type: item.type, + status: item.status }); - return ret; - }, + }); + result.emails = emails; + } + + if (privateInfoEligibility && loadData.address && results.privateInfo && results.privateInfo[0]) { 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. + }; + + 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; + 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 +1114,4 @@ exports.getMyProfile = { api.helper.handleNoConnection(api, connection, next); } } -}; \ No newline at end of file +}; diff --git a/actions/resetPassword.js b/actions/resetPassword.js index e11acbdd9..4b533e650 100644 --- a/actions/resetPassword.js +++ b/actions/resetPassword.js @@ -1,15 +1,49 @@ /* * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.0 - * @author LazyChild + * @version 1.1 + * @author LazyChild, isv + * + * changes in 1.1 + * - implemented generateResetToken function */ "use strict"; var async = require('async'); +var stringUtils = require("../common/stringUtils.js"); +var moment = require('moment-timezone'); + +var NotFoundError = require('../errors/NotFoundError'); var BadRequestError = require('../errors/BadRequestError'); var UnauthorizedError = require('../errors/UnauthorizedError'); var ForbiddenError = require('../errors/ForbiddenError'); +var TOKEN_ALPHABET = stringUtils.ALPHABET_ALPHA_EN + stringUtils.ALPHABET_DIGITS_EN; + +/** + * Looks up for the user account matching specified handle (either TopCoder handle or social login username) or email. + * If user account is not found then NotFoundError is returned to callback; otherwise ID for found user account is + * passed to callback. + * + * @param {String} handle - the handle to check. + * @param {String} email - the email to check. + * @param {Object} api - the action hero api object. + * @param {Object} dbConnectionMap - the database connection map. + * @param {Function} callback - the callback function. + */ +var resolveUserByHandleOrEmail = function (handle, email, api, dbConnectionMap, callback) { + api.dataAccess.executeQuery("find_user_by_handle_or_email", { handle: handle, email: email }, dbConnectionMap, + function (err, result) { + if (err) { + callback(err); + return; + } + if (result && result[0]) { + callback(null, result[0]); + } else { + callback(new NotFoundError("User does not exist")); + } + }); +}; /** * This is the function that stub reset password @@ -21,24 +55,21 @@ var ForbiddenError = require('../errors/ForbiddenError'); function resetPassword(api, connection, next) { var result, helper = api.helper; async.waterfall([ - function(cb) { - if (connection.params.handle == "nonValid") { + function (cb) { + if (connection.params.handle === "nonValid") { cb(new BadRequestError("The handle you entered is not valid")); - return; - } else if (connection.params.handle == "badLuck") { + } else if (connection.params.handle === "badLuck") { cb(new Error("Unknown server error. Please contact support.")); - return; - } else if (connection.params.token == "unauthorized_token") { + } else if (connection.params.token === "unauthorized_token") { cb(new UnauthorizedError("Authentication credentials were missing or incorrect.")); - return; - } else if (connection.params.token == "forbidden_token") { + } else if (connection.params.token === "forbidden_token") { cb(new ForbiddenError("The request is understood, but it has been refused or access is not allowed.")); - return; + } else { + result = { + "description": "Your password has been reset!" + }; + cb(); } - result = { - "description": "Your password has been reset!" - }; - cb(); } ], function (err) { if (err) { @@ -50,45 +81,55 @@ function resetPassword(api, connection, next) { }); } + /** - * This is the function that stub reset token + * Generates the token for resetting the password for specified user account. First checks if non-expired token already + * exists for the user. If so then BadRequestError is passed to callback. Otherwise a new token is generated and saved + * to cache and returned to callback. * + * @param {Number} userHandle - handle of user to generate token for. + * @param {String} userEmailAddress - email address of user to email generated token to. * @param {Object} api - The api object that is used to access the global infrastructure - * @param {Object} connection - The connection object for the current request - * @param {Function} next - The callback to be called after this function is done + * @param {Function} callback - the callback function. */ -function generateResetToken(api, connection, next) { - var result, helper = api.helper; - async.waterfall([ - function(cb) { - if (connection.params.handle == "nonValid" || connection.params.email == "nonValid@test.com") { - cb(new BadRequestError("The handle you entered is not valid")); - return; - } else if (connection.params.handle == "badLuck" || connection.params.email == "badLuck@test.com") { - cb(new Error("Unknown server error. Please contact support.")); - return; - } +var generateResetToken = function (userHandle, userEmailAddress, api, callback) { + var tokenCacheKey = 'tokens-' + userHandle + '-reset-token', + current, + expireDate, + expireDateString, + emailParams; - if (connection.params.handle == "googleSocial" || connection.params.email == "googleSocial@test.com") { - result = { - "socialLogin": "Google" - }; - } else { - result = { - "token": "a3cbG" - }; - } - cb(); - } - ], function (err) { + api.helper.getCachedValue(tokenCacheKey, function (err, token) { if (err) { - helper.handleError(api, connection, err); + callback(err); + } else if (token) { + // Non-expired token already exists for this user - raise an error + callback(new BadRequestError("You have already requested the reset token, please find it in your email inbox." + + " If it's not there. Please contact support@topcoder.com.")); } else { - connection.response = result; + // There is no token - generate new one + var newToken = stringUtils.generateRandomString(TOKEN_ALPHABET, 6), + lifetime = api.config.general.defaultResetPasswordTokenCacheLifetime; + api.cache.save(tokenCacheKey, newToken, lifetime); + + // Send email with token to user + current = new Date(); + expireDate = current.setSeconds(current.getSeconds() + lifetime / 1000); + expireDateString = moment(expireDate).tz('America/New_York').format('YYYY-MM-DD HH:mm:ss z'); + emailParams = { + handle: userHandle, + token: newToken, + expiry: expireDateString, + template: 'reset_token_email', + subject: api.config.general.resetPasswordTokenEmailSubject, + toAddress: userEmailAddress + }; + api.tasks.enqueue("sendEmail", emailParams, 'default'); + + callback(null, newToken); } - next(connection, true); }); -} +}; /** * Reset password API. @@ -113,8 +154,8 @@ exports.resetPassword = { * Generate reset token API. */ exports.generateResetToken = { - "name": "generateResetToken", - "description": "generateResetToken", + name: "generateResetToken", + description: "generateResetToken", inputs: { required: [], optional: ["handle", "email"] @@ -122,8 +163,49 @@ exports.generateResetToken = { blockedConnectionTypes: [], outputExample: {}, version: 'v2', + cacheEnabled: false, + transaction: 'read', + databases: ["common_oltp"], run: function (api, connection, next) { api.log("Execute generateResetToken#run", 'debug'); - generateResetToken(api, connection, next); + if (connection.dbConnectionMap) { + async.waterfall([ + function (cb) { // Find the user either by handle or by email + // Get handle, email from request parameters + var handle = (connection.params.handle || '').trim(), + email = (connection.params.email || '').trim(), + byHandle = (handle !== ''), + byEmail = (email !== ''); + + // Validate the input parameters, either handle or email but not both must be provided + if (byHandle && byEmail) { + cb(new BadRequestError("Both handle and email are specified")); + } else if (!byHandle && !byEmail) { + cb(new BadRequestError("Either handle or email must be specified")); + } else { + resolveUserByHandleOrEmail(handle, email, api, connection.dbConnectionMap, cb); + } + }, function (result, cb) { + if (result.social_login_provider_name !== '') { + // For social login accounts return the provider name + cb(null, null, result.social_login_provider_name); + } else { + // Generate reset password token for user + generateResetToken(result.handle, result.email_address, api, cb); + } + } + ], function (err, newToken, socialProviderName) { + if (err) { + api.helper.handleError(api, connection, err); + } else if (newToken) { + connection.response = {successful: true}; + } else if (socialProviderName) { + connection.response = {socialProvider: socialProviderName}; + } + next(connection, true); + }); + } else { + api.helper.handleNoConnection(api, connection, next); + } } }; diff --git a/actions/reviewOpportunities.js b/actions/reviewOpportunities.js index ecd43518e..11739c89d 100644 --- a/actions/reviewOpportunities.js +++ b/actions/reviewOpportunities.js @@ -1,7 +1,7 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.3 + * @version 1.4 * @author Sky_, Ghost_141 * changes in 1.1 * - Implement the studio review opportunities. @@ -10,12 +10,17 @@ * - remove getStudioReviewOpportunities method. * changes in 1.3: * - Implement the getSoftwareReviewOpportunity api. + * Changes in 1.4: + * - Implement the applyDevelopReviewOpportunity API. + * - add VALID_REVIEW_APPLICATION_ROLE_ID and REVIEW_APPLICATION_STATUS. */ 'use strict'; var async = require('async'); var _ = require('underscore'); +var moment = require('moment'); var NotFoundError = require('../errors/NotFoundError'); var IllegalArgumentError = require('../errors/IllegalArgumentError'); +var BadRequestError = require('../errors/BadRequestError'); var ForbiddenError = require('../errors/ForbiddenError'); /** @@ -68,6 +73,37 @@ var STUDIO_ALLOWABLE_QUERY_PARAMETER = ['round1ScheduledStartDate.type', 'round1 */ var SOFTWARE_REVIEW_TYPE = ['Iterative Review', 'Spec Review', 'Contest Review']; +/** + * Valid value for review application role id. + * + * @since 1.4 + */ +var VALID_REVIEW_APPLICATION_ROLE_ID = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + +/** + * The review application status object. + * + * @since 1.4 + */ +var REVIEW_APPLICATION_STATUS = { + pending: { + name: 'Pending', + id: 1 + }, + cancelled: { + name: 'Cancelled', + id: 2 + }, + approved: { + name: 'Approved', + id: 3 + }, + rejected: { + name: 'Rejected', + id: 4 + } +}; + /** * Format the date value to a specific pattern. * @param dateValue {String} the date value. @@ -519,7 +555,7 @@ var getReviewOpportunities = function (api, connection, isStudio, next) { */ var getSoftwareReviewOpportunity = function (api, connection, next) { var helper = api.helper, dbConnectionMap = connection.dbConnectionMap, challengeId, sqlParams, result = {}, - phases, positions, applications, basic, adjustPayment, + phases, positions, applications, basic, adjustPayment, assignedResource, execQuery = function (name) { return function (cb) { api.dataAccess.executeQuery(name, sqlParams, dbConnectionMap, cb); @@ -540,6 +576,7 @@ var getSoftwareReviewOpportunity = function (api, connection, next) { } sqlParams = { + challenge_id: challengeId, challengeId: challengeId, user_id: connection.caller.userId }; @@ -566,6 +603,7 @@ var getSoftwareReviewOpportunity = function (api, connection, next) { phases: execQuery('get_review_opportunity_detail_phases'), positions: execQuery('get_review_opportunity_detail_positions'), applications: execQuery('get_review_opportunity_detail_applications'), + resource: execQuery('get_assigned_review_resource_role'), adjustPayment: execQuery('search_software_review_opportunities_adjust_payment') }, cb); }, @@ -573,6 +611,7 @@ var getSoftwareReviewOpportunity = function (api, connection, next) { phases = results.phases; positions = results.positions; applications = results.applications; + assignedResource = results.resource; basic = results.basic[0]; adjustPayment = results.adjustPayment; @@ -594,16 +633,21 @@ var getSoftwareReviewOpportunity = function (api, connection, next) { }); }); + // Iterative each positions that this challenge have. positions.forEach(function (row) { var positionOpen, - approvedNumber = _.countBy(applications, - function (item) { - return item.review_application_role_id === row.review_application_role_id - && item.status === 'Approved'; - })['true'] || 0; - - if (approvedNumber === row.num_positions) { - // There is no spaces for new reviewer on this role. + isClosed = false, + i, + reviewApplicationRole = _.filter(results.basic, function (item) { return item.review_application_role_id === row.review_application_role_id; }); + + for (i = 0; i < reviewApplicationRole.length; i += 1) { + if (!isClosed && reviewApplicationRole[i].is_unique && assignedResource.indexOf(reviewApplicationRole[i].resource_role_id) >= 0) { + isClosed = true; + } + } + + if (isClosed) { + // Review application role is closed. return; } @@ -650,6 +694,275 @@ var getSoftwareReviewOpportunity = function (api, connection, next) { }); }; +/** + * Handle the apply develop review opportunities api. + * @param {Object} api - the api object. + * @param {Object} connection - the connection object. + * @param {Function} next - the callback function. + * @since 1.4 + */ +var applyDevelopReviewOpportunity = function (api, connection, next) { + var helper = api.helper, + caller = connection.caller, + resourceRoleNames = [], + dbConnectionMap = connection.dbConnectionMap, + challengeId = Number(connection.params.challengeId), + reviewApplicationRoleId = connection.params.reviewApplicationRoleId, + reviewAuctionId, + message, + reviewAssignmentDate, + currentUserApplications; + + // The reviewApplicationRoleId is undefined. Initialize it. + if (!_.isDefined(reviewApplicationRoleId)) { + reviewApplicationRoleId = []; + } + + // Only have one review application role id. + if (!_.isArray(reviewApplicationRoleId)) { + reviewApplicationRoleId = [reviewApplicationRoleId]; + } + // Unique the array and transfer the value to number. + reviewApplicationRoleId = _(reviewApplicationRoleId) + .chain() + .uniq() + .map(function (item) { return Number(item); }) + .value(); + + async.waterfall([ + function (cb) { + var error = helper.checkPositiveInteger(challengeId, 'challengeId') || + helper.checkMaxInt(challengeId, 'challengeId') || + helper.checkMember(connection, 'Anonymous user don\'t have permission to access this api.'); + + reviewApplicationRoleId.forEach(function (item) { + error = error || helper.checkContains(VALID_REVIEW_APPLICATION_ROLE_ID, item, 'reviewApplicationRoleId'); + }); + + if (error) { + cb(error); + return; + } + async.parallel({ + detail: function (cbx) { + api.dataAccess.executeQuery('review_opportunity_detail', { challenge_id: challengeId }, dbConnectionMap, cbx); + }, + applications: function (cbx) { + api.dataAccess.executeQuery('get_user_review_applications', { challenge_id: challengeId, user_id: caller.userId }, dbConnectionMap, cbx); + }, + resourceRoles: function (cbx) { + api.dataAccess.executeQuery('get_assigned_review_resource_role', { challenge_id: challengeId }, dbConnectionMap, cbx); + }, + reviewerCheck: function (cbx) { + api.dataAccess.executeQuery('check_reviewer', { challenge_id: challengeId, user_id: caller.userId }, dbConnectionMap, cbx); + }, + privateCheck: function (cbx) { + api.dataAccess.executeQuery('check_user_challenge_accessibility', { challengeId: challengeId, user_id: caller.userId }, dbConnectionMap, cbx); + } + }, cb); + }, + function (res, cb) { + var details = res.detail, + reviewerCheck = res.reviewerCheck, + availableApplicationIds = _.chain(details) + .map(function (item) { return item.review_application_role_id; }) + .uniq() + .value(), + privateCheck = res.privateCheck[0], + positionsLeft, + assignedResourceRoles = res.resourceRoles, + currentUserResourceRole = _.filter(assignedResourceRoles, function (item) { return item.user_id === caller.userId; }); + + currentUserApplications = res.applications; + + // The challenge not existed or don't have review opportunity. + if (details.length === 0) { + cb(new BadRequestError('The challenge is not existed or don\'t have any review opportunities or review registration is not open.')); + return; + } + // Initialize it after the definition check. + // The total review positions left for this challenge. + positionsLeft = details[0].positions_left; + // The reviewer assignment date. + reviewAssignmentDate = details[0].assignment_date; + // The review auction id. This will bed used when insert new review application. + reviewAuctionId = details[0].review_auction_id; + + // If the request review application role is not belong to this challenge. + if (_.difference(reviewApplicationRoleId, availableApplicationIds).length > 0) { + cb(new BadRequestError('You can\'t apply the review application role that do not belong to this challenge.')); + return; + } + + // Check if it's a reviewer of this kind of challenge. + // We only check this when caller is trying to apply review opportunity not cancel them. + if (reviewApplicationRoleId.length > 0 && reviewerCheck.length === 0) { + cb(new ForbiddenError('You are not a Review Board member.')); + return; + } + + // The caller can't access this private challenge. + if (privateCheck.is_private && !privateCheck.has_access) { + cb(new ForbiddenError('The user is not allowed to register this challenge review.')); + return; + } + + // We only check this when caller is trying to apply review opportunity not cancel them. + // Get the review resource role that belong to the caller. If the length > 0 then the user is a reviewer already. + if (reviewApplicationRoleId.length > 0 && currentUserResourceRole.length > 0) { + cb(new BadRequestError('You are already assigned as reviewer for the contest.')); + return; + } + + // Do not need reviewer anymore. + if (positionsLeft <= 0) { + cb(new BadRequestError('There are no open positions for this challenge.')); + return; + } + + // iterative the available review application role ids for this challenge. + // The results of this function will be a array of resource role names(The role that caller applied). So we can check the terms of use later. + async.eachSeries(availableApplicationIds, function (roleId, cbx) { + var reviewApplicationRole = _.filter(details, function (item) { return item.review_application_role_id === roleId; }), + positionsNeeds = Math.min(positionsLeft, reviewApplicationRole[0].positions), + isClosed = false, + assignedRoles = _.map(assignedResourceRoles, function (item) { return item.resource_role_id; }), + i; + + if (reviewApplicationRoleId.indexOf(roleId) < 0) { + // The caller not apply this role. + // Update the reviewers count before callback. + positionsLeft -= positionsNeeds; + cbx(); + return; + } + + for (i = 0; i < reviewApplicationRole.length; i += 1) { + if (!isClosed && reviewApplicationRole[i].is_unique && assignedRoles.indexOf(reviewApplicationRole[i].resource_role_id) >= 0) { + isClosed = true; + } + } + + // The review application role is closed so no need to calculate the positions left(we already did in query). + if (isClosed) { + cb(new BadRequestError('There is no open positions for selected review application role: ' + reviewApplicationRole[0].role_name + '.')); + return; + } + + if (positionsLeft === 0) { + cbx(new BadRequestError('There is no open positions for selected review application role: ' + reviewApplicationRole[0].role_name + '.')); + return; + } + + // Has the positions apply the role. + // Store the resource role for later terms of use check. + resourceRoleNames = _.union(resourceRoleNames, + _.chain(details) + .filter(function (item) { return item.review_application_role_id === roleId; }) + .map(function (item) { return item.resource_role_name; }) + .value()); + positionsLeft -= positionsNeeds; + cbx(); + }, function (err) { + cb(err); + }); + }, + function (cb) { + // Check the terms of use for each resource role here. + async.eachSeries(resourceRoleNames, function (role, cbx) { + api.challengeHelper.getChallengeTerms(connection, challengeId, role, false, dbConnectionMap, function (err, terms) { + if (err) { + cbx(err); + return; + } + // If the terms has not been all agreed. + // We don't allow people who has agree all terms. So simply return an error. + if (helper.allTermsAgreed(terms) !== true) { + cb(new ForbiddenError('You should agree with all terms of use.')); + return; + } + cbx(); + }); + }, function (err) { + cb(err); + }); + }, + function (cb) { + // Update or insert the review application. + var currentPendingAppliedApplication = _.filter(currentUserApplications, function (item) { return item.status === REVIEW_APPLICATION_STATUS.pending.name; }), + // The current pending applied application role id for the caller. + currentPendingApplied = _.map(currentPendingAppliedApplication, function (item) { return item.role_id; }), + // The review application role id to remove. + roleToRemove = _.difference(currentPendingApplied, reviewApplicationRoleId), + // The review application role id to add. + roleToAdd = _.difference(reviewApplicationRoleId, currentPendingApplied); + + async.parallel({ + update: function (cbx) { + // Update the role to cancelled status. + async.each(roleToRemove, function (roleId, callback) { + var reviewApplicationId = _.find(currentPendingAppliedApplication, function (item) { return item.role_id === roleId; }).review_application_id; + api.dataAccess.executeQuery('update_review_application', + { review_application_id: reviewApplicationId, status: REVIEW_APPLICATION_STATUS.cancelled.id }, + dbConnectionMap, callback); + }, function (err) { + cbx(err); + }); + }, + add: function (cbx) { + // Add the new application. + async.each(roleToAdd, function (roleId, callback) { + api.idGenerator.getNextIDFromDb('REVIEW_APPLICATION_SEQ', 'tcs_catalog', dbConnectionMap, function (err, id) { + if (err) { + callback(err); + return; + } + api.dataAccess.executeQuery('insert_review_application', + { + review_application_id: id, + review_auction_id: reviewAuctionId, + role_id: roleId, + user_id: caller.userId, + status: REVIEW_APPLICATION_STATUS.pending.id + }, dbConnectionMap, callback); + }); + }, function (err) { + cbx(err); + }); + } + }, function (err) { + cb(err); + }); + }, + function (cb) { + // Register succeed. Prepare the message. + if (reviewApplicationRoleId.length === 0) { + // The user is intend to remove all reigstered review applications. + message = 'Your review application for this contest has been cancelled.'; + } else if (moment(reviewAssignmentDate).isAfter()) { + // The assignment date is not arrived yet. + message = 'You have successfully applied to review this contest. The system will automatically select ' + + 'reviewers that best match the review positions for this contest on ' + + helper.formatDate(reviewAssignmentDate, 'MM.DD.YYYY HH:mm z') + '. You will be notified by email ' + + 'what review role you were assigned to.'; + } else { + // The assignment date is passed. + message = 'You have successfully applied to review this contest. The system will automatically decide ' + + 'whether you match the reviewer requirements for this contest now. You will be notified by email ' + + 'shortly.'; + } + cb(); + } + ], function (err) { + if (err) { + helper.handleError(api, connection, err); + } else { + connection.response = { message: message }; + } + next(connection, true); + }); +}; + /** * The API for searching review opportunities */ @@ -700,6 +1013,33 @@ exports.getSoftwareReviewOpportunity = { } }; +/** + * Apply Develop Review Opportunity API. + * @since 1.4 + */ +exports.applyDevelopReviewOpportunity = { + name: 'applyDevelopReviewOpportunity', + description: 'applyDevelopReviewOpportunity', + inputs: { + required: ['challengeId'], + optional: ['reviewApplicationRoleId'] + }, + blockedConnectionTypes: [], + outputExample: {}, + cacheEnabled: false, + version: 'v2', + transaction: 'write', + databases: ['tcs_catalog', 'common_oltp'], + run: function (api, connection, next) { + if (connection.dbConnectionMap) { + api.log('Execute applyDevelopReviewOpportunity#run', 'debug'); + applyDevelopReviewOpportunity(api, connection, next); + } else { + api.helper.handleNoConnection(api, connection, next); + } + } +}; + /** * The API for getting review opportunities for studio */ diff --git a/actions/rss.js b/actions/rss.js new file mode 100644 index 000000000..1347547cc --- /dev/null +++ b/actions/rss.js @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author Ghost_141 + */ +"use strict"; + +var async = require('async'); +var _ = require('underscore'); +var BadRequestError = require('../errors/BadRequestError'); +var UnauthorizedError = require('../errors/UnauthorizedError'); +var ForbiddenError = require('../errors/ForbiddenError'); + +/** + * valid value for challenge type. + */ +var VALID_CHALLENGE_TYPE = ['develop', 'design', 'data']; + +/** + * Get the challenges RSS information. + * + * @param {Object} api - The api object that is used to access the global infrastructure + * @param {Object} connection - The connection object for the current request + * @param {Function} next - The callback to be called after this function is done + */ +function getChallengesRSS(api, connection, next) { + var result, helper = api.helper, + dbConnectionMap = connection.dbConnectionMap, + RSSMaxLength = api.config.general.maxRSSLength, + positionsRemain = RSSMaxLength, + challengeType = connection.params.challengeType, + listType = (connection.params.listType || helper.ListType.OPEN).toUpperCase(), + copyToResult = function (queryResults) { + if (positionsRemain > 0) { + var i, row, res; + for (i = 0; i < Math.min(positionsRemain, queryResults.length); i += 1) { + row = queryResults[i]; + res = { + challengeType: row.challenge_type.trim(), + challengeName: row.challenge_name, + challengeId: row.challenge_id, + detailedRequirements: row.detailed_requirements || '', + projectId: row.project_id + }; + if (_.isDefined(row.software_detailed_requirements)) { + res.detailedRequirements = row.software_detailed_requirements || ''; + } + if (_.isDefined(row.studio_detailed_requirements)) { + res.detailedRequirements = row.studio_detailed_requirements || ''; + } + result.data.push(res); + } + positionsRemain -= queryResults.length; + } + }; + async.waterfall([ + function (cb) { + var error; + if (_.isDefined(challengeType)) { + error = helper.checkContains(VALID_CHALLENGE_TYPE, challengeType.toLowerCase(), 'challengeType'); + } + error = error || helper.checkContains(helper.VALID_LIST_TYPE, listType, 'listType'); + if (error) { + cb(error); + return; + } + + challengeType = (challengeType || 'all').toLowerCase(); + + async.parallel({ + design: function (cbx) { + if (challengeType === 'design' || challengeType === 'all') { + api.dataAccess.executeQuery('get_software_studio_challenges_rss', + { + page_size: RSSMaxLength, + project_status_id: helper.LIST_TYPE_PROJECT_STATUS_MAP[listType], + project_type_id: helper.studio.category, + registration_phase_status: helper.LIST_TYPE_REGISTRATION_STATUS_MAP[listType] + }, dbConnectionMap, cbx); + } else { + cbx(); + } + }, + develop: function (cbx) { + if (challengeType === 'develop' || challengeType === 'all') { + api.dataAccess.executeQuery('get_software_studio_challenges_rss', + { + page_size: RSSMaxLength, + project_status_id: helper.LIST_TYPE_PROJECT_STATUS_MAP[listType], + project_type_id: helper.software.category, + registration_phase_status: helper.LIST_TYPE_REGISTRATION_STATUS_MAP[listType] + }, dbConnectionMap, cbx); + } else { + cbx(); + } + }, + data: function (cbx) { + if (challengeType === 'data' || challengeType === 'all') { + if (listType === helper.ListType.PAST) { + api.dataAccess.executeQuery('get_past_data_challenges_rss', { page_size: RSSMaxLength }, dbConnectionMap, cbx); + } else if (listType === helper.ListType.OPEN || listType === helper.ListType.ACTIVE) { + api.dataAccess.executeQuery('get_open_data_challenges_rss', { page_size: RSSMaxLength }, dbConnectionMap, cbx); + } else { + cbx(); + } + } else { + cbx(); + } + } + }, cb); + }, + function (results, cb) { + result = { + data: [] + }; + _.compact([results.design, results.develop, results.data]).forEach(function (item) { + copyToResult(item); + }); + result.total = result.data.length; + cb(); + } + ], function (err) { + if (err) { + helper.handleError(api, connection, err); + } else { + connection.response = result; + } + next(connection, true); + }); +} + +/** + * Get Challenges RSS API. + */ +exports.getChallengesRSS = { + name: 'getChallengesRSS', + description: 'getChallengesRSS', + inputs: { + required: [], + optional: ['listType', 'challengeType'] + }, + blockedConnectionTypes: [], + outputExample: {}, + version: 'v2', + transaction: 'read', // this action is read-only + databases: ['informixoltp', 'tcs_catalog', 'topcoder_dw'], + run: function (api, connection, next) { + api.log('Execute getChallengesRSS#run', 'debug'); + getChallengesRSS(api, connection, next); + } +}; diff --git a/actions/user.js b/actions/user.js index 11b3816a3..64496407f 100644 --- a/actions/user.js +++ b/actions/user.js @@ -7,8 +7,6 @@ 'use strict'; var async = require('async'); var _ = require('underscore'); -var bigdecimal = require('bigdecimal'); -var bignum = require('bignum'); var BadRequestError = require('../errors/BadRequestError'); var ForbiddenError = require('../errors/ForbiddenError'); var UnauthorizedError = require('../errors/UnauthorizedError'); diff --git a/apiary.apib b/apiary.apib index c7abceca9..cc55c7af3 100644 --- a/apiary.apib +++ b/apiary.apib @@ -635,7 +635,10 @@ Register a new user. "country" : "UK", "email" : "name@domain.com", "password" : "HashedPassword", - "regSource": "http://registration.source.domain.com" + "regSource": "http://registration.source.domain.com", + "utm_source": "a", + "utm_medium": "b", + "utm_campaign": "c" } ### Create a new user [POST] @@ -1063,7 +1066,49 @@ Register a new user. "address": "address1, city, Maine, 04043, United States", "age": "25 - 34", "gender": "Male", - "shirt_size": "Medium" + "shirt_size": "Medium", + "privacy": { + "showMySchool": "Yes", + "showMyEarnings": "No", + "receiveMessages": "Yes", + "messageBlackList": ["handleA", "handleB"] + }, + "emailNotification": { + "competitionAnnouncements": { + "algorithmCompetitions": "No", + "softwareDevelopmentOpportunities": "Yes", + "topCoderStudioCompetitions": "No" + }, + "others": { + "employmentOpportunities": "Yes", + "topCoderNewsAndEvents": "Yes", + "topCoderDesignStudioNewsletter": "No" + } + }, + "demographic": { + "nonEnglishName": "name1", + "jobTitle": "Lorem ipsum", + "company": "company1", + "country": "Indonesia", + "representedCountry": "Indonesia", + "phone": "555555", + "timeZone": "US/Central", + "age": "18 - 25", + "gender": "Male", + "ethnicBackground": "Asian or Pacific Islander", + "primaryInterest": "Creative Competition", + "shirtSize": "Small", + "collegeMajor": "Computer Science", + "collegeMajorDescription": "Software Design", + "degreeProgram": "Bachelors", + "graduationDate": "21/02/2011", + "clubsOrOrganizations": "None", + "school": "Harvard University", + "gpa": 3.5, + "gpaScale": 5, + "isStudent": "Yes", + "isProfessional": "No" + } } + Response 400 (application/json) @@ -1175,17 +1220,17 @@ Register a new user. ## Generate Reset Token [/users/resetToken/?handle={handle}&email={email}] ### Generate Reset Token [GET] -- return token for topcoder user +- return "successful" flag set to true - return social provider name for social login user + Parameters - + handle (optional, string, `iRabbit`) ... Member Handle - + email (optional, string, `test@test.com`) ... Email Address + + handle (optional, string, `iRabbit`) ... Member Handle or Social Login Username + + email (optional, string, `test@test.com`) ... Member Email (mutually exclusive with handle parameter) + Response 200 (application/json) { - "token":"a3cbG" + "successful":"true" } + Response 200 (application/json) @@ -1199,7 +1244,31 @@ Register a new user. { "name":"Bad Request", "value":"400", - "description":"The handle you entered is not valid" + "description":"Either handle or email must be specified" + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"Both handle and email are specified" + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"You have already requested the reset token, please find it in your email inbox. If it's not there. Please contact support@topcoder.com." + } + ++ Response 404 (application/json) + + { + "name":"Not Found", + "value":"404", + "description":"User does not exist" } + Response 500 (application/json) @@ -1218,6 +1287,7 @@ Register a new user. "description":"Servers are up but overloaded. Try again later." } + ## Reset Password [/users/resetPassword/{handle}] ### Reset Password [POST] + Parameters @@ -1375,74 +1445,6 @@ Register a new user. "description":"Unknown server error. Please contact support." } -+ Response 503 (application/json) - - { - "name":"Service Unavailable", - "value":"503", - "description":"Servers are up but overloaded. Try again later." - } - -## User Preference [/users/preference/{handle}] -### User Preference [GET] -+ Parameters - + handle (required, string, `iRabbit`) ... Member Handle - -+ Response 200 (application/json) - - { - "privacy": { - "showMySchool": "Yes", - "showMyEarnings": "No", - "receiveMessages": "Yes", - "messageBlackList": ["handleA", "handleB"] - }, - "emailNotification": { - "competitionAnnouncements": { - "algorithmCompetitions": "No", - "softwareDevelopmentOpportunities": "Yes", - "topCoderStudioCompetitions": "No" - }, - "others": { - "employmentOpportunities": "Yes", - "topCoderNewsAndEvents": "Yes", - "topCoderDesignStudioNewsletter": "No" - } - } - } - -+ Response 400 (application/json) - - { - "name":"Bad Request", - "value":"400", - "description":"This message will explain why the request is invalid or cannot be served." - } - -+ Response 401 (application/json) - - { - "name":"Unauthorized", - "value":"401", - "description":"Authentication credentials were missing or incorrect." - } - -+ Response 403 (application/json) - - { - "name":"Forbidden", - "value":"403", - "description":"The request is understood, but it has been refused or access is not allowed." - } - -+ Response 500 (application/json) - - { - "name":"Internal Server Error", - "value":"500", - "description":"Unknown server error. Please contact support." - } - + Response 503 (application/json) { @@ -1668,6 +1670,165 @@ Register a new user. "description":"Servers are up but overloaded. Try again later." } + +## Apply Develop Review Opportunity Detail [/develop/reviewOpportunities/{challengeId}/apply] +### Apply Develop Review Opportunity Information [POST] + ++ Request + + Authorization : Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZHwxMzI0NTYiLCJleHAiOjEzOTQwODA3MTEsImF1ZCI6InRvcGNvZGVyIiwiaWF0IjoxMzk0MDIwNzExfQ.xaaaElykyAq3woRRkcFQSUK0gvKnRCOhCD57x070GJ4 + ++ Parameters + + + challengeId (required, number, `30000000`) ... The challenge id. + + reviewApplicationRoleId (optional, number, `1`) ... The review application role id to apply. + ++ Response 200 (application/json) + + { + "message": "Your review application for this contest has been cancelled." + } + ++ Response 200 (application/json) + + { + "message": "You have successfully applied to review this contest. The system will automatically select reviewers that best match the review positions for this contest on 03.26.2014 08:00. You will be notified by email what review role you were assigned to." + } + ++ Response 200 (application/json) + + { + "message": "You have successfully applied to review this contest. The system will automatically decide whether you match the reviewer requirements for this contest now. You will be notified by email shortly." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeId should be number." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeId should be positive." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeId should be Integer." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeId should be less or equal to 2147483647." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"reviewApplicationRoleId should be an element of 1,2,3,4,5,6,7,8,9." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"The challenge is not existed or don't have any review opportunities or review registration is not open." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"You can't apply the review application role that do not belong to this challenge." + } + ++ Response 403 (application/json) + + { + "name":"Forbidden", + "value":"403", + "description":"You are not a Review Board member." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"You are already assigned as reviewer for the contest." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"There are no open positions for this challenge." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"There is no open positions for selected review application role: Primary Reviewer." + } + ++ Response 403 (application/json) + + { + "name":"Forbidden", + "value":"403", + "description":"You should agree with all terms of use." + } + ++ Response 401 (application/json) + + { + "name":"Unauthorized", + "value":"401", + "description":"Anonymous user don't have permission to access this api." + } + ++ Response 403 (application/json) + + { + "name":"Forbidden", + "value":"403", + "description":"The user is not allowed to register this challenge review." + } + ++ Response 500 (application/json) + + { + "name":"Internal Server Error", + "value":"500", + "description":"Unknown server error. Please contact support." + } + ++ Response 503 (application/json) + + { + "name":"Service Unavailable", + "value":"503", + "description":"Servers are up but overloaded. Try again later." + } + ## Challenge Reviewers Collection [/develop/reviewers/{contestType}] ### List reviewers of current challenge type [GET] @@ -2127,11 +2288,11 @@ Register a new user. "description":"Servers are up but overloaded. Try again later." } -## Get Software Challenge Detail [/develop/challenges/{id}] +## Get Software Challenge Detail [/develop/challenges/{challengeId}] ### Get Software Challenge Information [GET] + Parameters - + id (required, number, `30000000`) ... The challenge id. + + challengeId (required, number, `30000000`) ... The challenge id. + Response 200 (application/json) @@ -2721,7 +2882,8 @@ Register a new user. + Request (application/json) + Parameters - + submissionFile (required, string, `abcd.zip`) ... The submission zip + + fileName (required, string, `abcd.zip`) ... The name of the file that is being uploaded + + fileData (required, string, `SGVsbG8gV29ybGQ=`) ... The Base64 encoded content of the file being uploaded. The example value is 'Hello World' base64 encoded + type (optional, string, `checkpoint`) ... The type of submission. Can be 'final' or 'checkpoint'. If absent, 'final' is assumed. + Response 200 (application/json) @@ -3063,11 +3225,11 @@ Register a new user. "description":"Servers are up but overloaded. Try again later." } -## Get Studio Challenge Detail [/design/challenges/{id}] +## Get Studio Challenge Detail [/design/challenges/{challengeId}] ### Get Studio Challenge Information [GET] + Parameters - + id (required, number, `30000000`) ... The challenge id. + + challengeId (required, number, `30000000`) ... The challenge id. + Response 200 (application/json) @@ -4462,8 +4624,8 @@ Register a new user. "description":"Servers are up but overloaded. Try again later." } -## Register Marathon Match Challenge [/data/marathon/challenges/{roundId}/register] -### Register Marathon Match Challenge [POST] +## Get Marathon Match Challenge Reg Info [/data/marathon/challenges/{roundId}/regInfo] +### Get Marathon Match Challenge Reg Info [GET] + Parameters + roundId (required, number, `30000000`) ... The challenge round id. @@ -4477,10 +4639,203 @@ Register a new user. + Response 200 (application/json) { - success: true - } - -+ Response 400 (application/json) + "term": { + "contestName": "Marathon Match 90", + "roundName": "Round 2001", + "termsContent": "Marathon Match terms content" + }, + "questions": [ + { + "id": 1000, + "style": "Multiple Choice", + "type": "Eligible", + "text": "question 1000", + "answers": [ + { + "id": 1002, + "text": "answer text 1", + "sortOrder": 1, + "correct": true + }, + { + "id": 1001, + "text": "answer text 2", + "sortOrder": 2, + "correct": false + }, + { + "id": 1003, + "text": "answer text 3", + "sortOrder": 3, + "correct": false + } + ] + }, + { + "id": 1001, + "style": "Short Answer", + "type": "Personal", + "text": "question 1001", + "answers": [] + }, + { + "id": 1002, + "style": "Single Choice", + "type": "Eligible", + "text": "question 1002", + "answers": [ + { + "id": 1004, + "text": "answer text 4", + "sortOrder": -1, + "correct": false + }, + { + "id": 1005, + "text": "answer text 5", + "sortOrder": 1, + "correct": true + } + ] + } + ] + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details:":"You are not eligible to participate in this competition." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details:":"Round doesn't exist 30005520." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"In order to participate in this competition, you must register for Event 30005520. Registration is available: here. Please register at the provided URL first and then repeat registration at Marathon Match Active Contests page." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"Registration is not currently open." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"You are not eligible to participate in this competition. Please contact support@topcoder.com if you have any questions." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"Sorry, this round is by invitation only." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"Sorry, you can not register for this round, you must compete in the version of this round that you were invited to." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"There are no more spots available for the round." + } + ++ Response 401 (application/json) + + { + "name":"Unauthorized", + "value":"401", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"Authorization information needed or incorrect." + } + ++ Response 403 (application/json) + + { + "name":"Forbidden", + "value":"403", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"The user is forbidden to access this endpoint." + } + ++ Response 404 (application/json) + + { + "name":"Not Found", + "value":"404", + "description":"This message will explain why the request is invalid or cannot be served." + "details":"Could not find specified round terms." + } + ++ Response 500 (application/json) + + { + "name":"Internal Server Error", + "value":"500", + "description":"Unknown server error. Please contact support." + } + ++ Response 503 (application/json) + + { + "name":"Service Unavailable", + "value":"503", + "description":"Servers are up but overloaded. Try again later." + } + + +## Register Marathon Match Challenge [/data/marathon/challenges/{roundId}/register] +### Register Marathon Match Challenge [POST] + ++ Parameters + + roundId (required, number, `30000000`) ... The challenge round id. + ++ Request + + + Headers + + Authorization : Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZHwxMzI0NTYiLCJleHAiOjEzOTI4MTc4ODQsImF1ZCI6InRvcGNvZGVyIiwiaWF0IjoxMzkyNzU3ODg0fQ.7X2IKkiyyI1ExSM5GNpdhJ8fGGK5-oAjzccX6YL_BKY + ++ Response 200 (application/json) + + { + success: true + } + ++ Response 400 (application/json) { "name":"Bad Request", @@ -5451,6 +5806,134 @@ Register a new user. "description":"Servers are up but overloaded. Try again later." } +## Unregister for a software/studio challenge [/challenges/{challengeId}/unregister] +### Unregister for a software/studio challenge [POST] + ++ Parameters + + challengeId (required, number, `1234567`) ... The challenge for which to Unregister + ++ Request + + + Headers + + Authorization : Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZHwxMzI0NTYiLCJleHAiOjEzOTM3MDM1NzEsImF1ZCI6InRvcGNvZGVyIiwiaWF0IjoxMzkzNjQzNTcxfQ.F2iohKp2nwjQeGqrBD1wn42GJUD0r28aGjhDle7KujA + ++ Response 200 (application/json) + + { + "message":"ok" + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeId should be less or equal to 2147483647." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeId should be number." + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeId should be positive." + } + ++ Response 401 (application/json) + + { + "name":"Unauthorized", + "value":"401", + "description":"You don\'t have the authority to access this. Please login." + } + ++ Response 403 (application/json) + + { + "name":"Forbidden", + "value":"403", + "description":"You cannot unregister since registration phase is closed." + } + ++ Response 403 (application/json) + + { + "name":"Forbidden", + "value":"403", + "description":"You are not registered for this challenge." + } + ++ Response 404 (application/json) + + { + "name":"Not Found", + "value":"404", + "description":"No such challenge exists." + } + ++ Response 500 (application/json) + + { + "name":"Internal Server Error", + "value":"500", + "description":"Unknown server error. Please contact support." + } + ++ Response 500 (application/json) + + { + "name": "Internal Server Error", + "value": 500, + "description": "Something is broken. Please contact support.", + "details": "Failed to connect to forum" + } + ++ Response 500 (application/json) + + { + "name": "Internal Server Error", + "value": 500, + "description": "Something is broken. Please contact support.", + "details": "Could not find user challenge resource" + } + + ++ Response 500 (application/json) + + { + "name": "Internal Server Error", + "value": 500, + "description": "Something is broken. Please contact support.", + "details": "Could not find user challenge forum" + } + + ++ Response 500 (application/json) + + { + "name": "Internal Server Error", + "value": 500, + "description": "Something is broken. Please contact support.", + "details": "Could not find forum category 3" + } + ++ Response 503 (application/json) + + { + "name":"Service Unavailable", + "value":"503", + "description":"Servers are up but overloaded. Try again later." + } + # Group Terms Of Use API ## View terms of use [/terms/detail/{termsOfUseId}] ### View terms of use by id [GET] @@ -6052,3 +6535,170 @@ Register a new user. "value":"503", "description":"Servers are up but overloaded. Try again later." } + +# Group Payments API +Payments APIs + +## Payment Preference [/payments/preference] +### Payment Preference [GET] + ++ Response 200 (application/json) + + { + "paymentAccrualAmount": 50, + "paymentMethod": "WesternUnion", + "paypalAccountEmail": "test@paypal.com" + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"challengeType should be an element of develop,design,data." + } + ++ Response 404 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"listType should be an element of ACTIVE,OPEN,UPCOMING,PAST." + } + ++ Response 500 (application/json) + + { + "name":"Internal Server Error", + "value":"500", + "description":"Unknown server error. Please contact support." + } + ++ Response 503 (application/json) + + { + "name":"Service Unavailable", + "value":"503", + "description":"Servers are up but overloaded. Try again later." + } + +## Payment List [/payments?type={type}&status={status}&pageIndex={pageIndex}&pageSize={pageSize}&sortColumn={sortColumn}&sortOrder={sortOrder}] +### Payment List [GET] + ++ Parameters + + status (optional, string, `Paid`) ... Payment Status: Paid, Owed, Cancelled, Entered into payment system + + type (optional, string, `Contest Payment`) ... Payment Type: Contest Payment, Review Payment, Copilot Payment, etc.. + + pageIndex (optional, number, `1`) ... The page index of the returned resources. 1-based. It can be null. The default value will be 1 + + pageSize (optional, number, `50`) ... The page size of the returned resources. 1-based. It can be null. The default value will be 10. + + sortColumn (optional, string, `description`) ... The column name to sort, can be null. + + sortOrder (optional, string, `asc`) ... The sorting order, can be null. If it's set, it can only be 'asc' or 'desc'. + ++ Response 200 (application/json) + + { + "total": 21, + "pageIndex": 1, + "pageSize": 2, + "payments": [ + { + "description": "[TCCC-4789] - Cockpit Instant Search Task", + "type": "Contest Payment", + "createDate": "12/13/2012", + "releaseDate": "13/01/1012", + "status": "Paid", + "amount": 250 + }, + { + "description": "(Application, v1.0) TC API - Studio Challenge Result API Update - First2Finish review board", + "type": "Review Board Payment", + "createDate": "12/13/2012", + "releaseDate": "13/01/1012", + "status": "Paid", + "amount": 3 + } + ], + "summary": { + "paid": 10000.0, + "owed": 1234.0, + "cancelled": 100.0, + "enteredIntoPaymentSystem": 50.0 + } + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"This message will explain why the request is invalid or cannot be served." + } + ++ Response 404 (application/json) + + { + "name":"Not Found", + "value":"404", + "description":"This message will explain why the URI requested is invalid or the resource does not exist." + } + ++ Response 500 (application/json) + + { + "name":"Internal Server Error", + "value":"500", + "description":"Unknown server error. Please contact support." + } + ++ Response 503 (application/json) + + { + "name":"Service Unavailable", + "value":"503", + "description":"Servers are up but overloaded. Try again later." + } + +## Docusign Callback [/terms/docusignCallback] +### Docusign Callback [POST] + ++ Parameters + + envelopeStatus (required, String, `Complete`) ... The status of the envelope + + envelopeId (required, UUID, `9103DC77-D8F1-4D7B-BED1-6116604EE98C`) ... The envelope to process + + tabs (required, Array, [{tabLabel: 'Handle', tabValue: 'anix'}, {...}]) ... The tab values. Can be empty + + connectKey (required, String, 'ABCDED-12435-EDFADSEC') The conenct key + ++ Response 200 (application/json) + { + "message": "some message" + } + ++ Response 400 (application/json) + + { + "name":"Bad Request", + "value":"400", + "description":"The request was invalid. An accompanying message will explain why." + } + ++ Response 404 (application/json) + + { + "name":"Not Found", + "value":"404", + "description":"This message will explain why the URI requested is invalid or the resource does not exist." + } + ++ Response 500 (application/json) + + { + "name":"Internal Server Error", + "value":"500", + "description":"Unknown server error. Please contact support." + } + ++ Response 503 (application/json) + + { + "name":"Service Unavailable", + "value":"503", + "description":"Servers are up but overloaded. Try again later." + } diff --git a/common/stringUtils.js b/common/stringUtils.js index 460eb2261..0187d02a6 100644 --- a/common/stringUtils.js +++ b/common/stringUtils.js @@ -1,8 +1,11 @@ /* - * Copyright (C) 2013 TopCoder Inc., All Rights Reserved. + * Copyright (C) 2013-2014 TopCoder Inc., All Rights Reserved. * - * Version: 1.0 - * Author: TCSASSEMBLER + * Version: 1.1 + * Author: isv + * + * changes in 1.1: + * - add generateRandomString function. */ "use strict"; @@ -39,6 +42,23 @@ exports.containsOnly = function (string, alphabet) { return true; }; +/** + * Generates random string of specified length using the symbols from the specified alphabet. + * + * @param {String} alphabet - alphabet to use for string generation. + * @param {Number} length - the length for the string to be generated. + * @since 1.1 + */ +exports.generateRandomString = function (alphabet, length) { + var text = '', i, index; + for (i = 0; i < length; i = i + 1) { + index = Math.random() * alphabet.length; + text += alphabet.charAt(index); + } + + return text; +}; + exports.ALPHABET_ALPHA_UPPER_EN = ALPHABET_ALPHA_UPPER_EN; exports.ALPHABET_ALPHA_LOWER_EN = ALPHABET_ALPHA_LOWER_EN; exports.ALPHABET_ALPHA_EN = ALPHABET_ALPHA_EN; diff --git a/config.js b/config.js index e7cc9359e..a5f00899b 100644 --- a/config.js +++ b/config.js @@ -1,8 +1,8 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @author vangavroche, Ghost_141, kurtrips, Sky_, isv - * @version 1.16 + * @author vangavroche, Ghost_141, kurtrips, Sky_, isv, TCSASSEMBLER + * @version 1.19 * changes in 1.1: * - add defaultCacheLifetime parameter * changes in 1.2: @@ -32,6 +32,7 @@ * - add defaultUserCacheLifetime property. * changes in 1.13: * - add jive in database mapping. + * - added the docusign object * - add grantForumAccess property. * Changes in 1.14: * - add redis.cacheFileTypesKey, redis.cacheDefaultLifetime, designSubmissionTmpPath, designSubmissionsBasePath @@ -39,6 +40,11 @@ * - added configuration for Docusign integration. * Changes in 1.16: * - add welcome email property. + * Changes in 1.17: + * - add maxRSSLength. + * changes in 1.19: + * - add defaultResetPasswordTokenCacheLifetime property. + * - add resetPasswordTokenEmailSubject property. */ "use strict"; @@ -80,6 +86,8 @@ config.general = { defaultCacheLifetime : process.env.CACHE_EXPIRY || 1000 * 60 * 10, //10 min default defaultAuthMiddlewareCacheLifetime : process.env.AUTH_MIDDLEWARE_CACHE_EXPIRY || 1000 * 60 * 10, //10 min default defaultUserCacheLifetime: process.env.USER_CACHE_EXPIRY || 1000 * 60 * 60 * 24, //24 hours default + defaultResetPasswordTokenCacheLifetime: process.env.RESET_PASSWORD_TOKEN_CACHE_EXPIRY ? parseInt(process.env.RESET_PASSWORD_TOKEN_CACHE_EXPIRY, 10) : 1000 * 60 * 30, //30 min + resetPasswordTokenEmailSubject: process.env.RESET_PASSWORD_TOKEN_EMAIL_SUBJECT || "TopCoder Account Password Reset", cachePrefix: '', oauthClientId: process.env.OAUTH_CLIENT_ID || "CMaBuwSnY0Vu68PLrWatvvu3iIiGPh7t", //auth0 secret is encoded in base64! @@ -100,7 +108,8 @@ config.general = { * The directory where uploaded files are stored. * It can be relative to the current directory or can be absolute */ - uploadsRootDirectory: process.env.UPLOADS_ROOT_DIRECTORY || "test/test_files/dev_download_submission" + uploadsRootDirectory: process.env.UPLOADS_ROOT_DIRECTORY || "test/test_files/dev_download_submission", + maxRSSLength: 1000 }; ///////////// @@ -193,7 +202,7 @@ config.tasks = { // ['high,low'] is one worker working 2 queues queues: ['default'], // how long to sleep between jobs / scheduler checks - timeout: 5000, + timeout: process.env.TASK_TIMEOUT || 5000, // What redis server should we connect to for tasks / delayed jobs? redis: config.redis }; @@ -277,9 +286,8 @@ config.submissionDir = process.env.SUBMISSION_DIR || 'test/tmp/submissions'; config.thurgoodDownloadUsername = process.env.THURGOOD_DOWNLOAD_USERNAME || "iamthurgood"; config.thurgoodDownloadPassword = process.env.THURGOOD_DOWNLOAD_PASSWORD || "secret"; -//Max size of a submission. Currently set to 2KB for test purpose. On production, it will be in the order of 100s of MB -//Set to 0 or negative for no size limit. -config.submissionMaxSizeBytes = 2048; +//Max size of a submission. Currently set to 10M for now. +config.submissionMaxSizeBytes = 10485760; //////Thurgood configurables/////// config.thurgoodCodeUrl = 'https://software.topcoder.com/review/actions/DownloadContestSubmission.do?method=downloadContestSubmission%26uid='; @@ -309,11 +317,16 @@ config.docusign = { roleName: process.env.DOCUSIGN_ROLENAME || 'Member', clientUserId: process.env.DOCUSIGN_CLIENT_USER_ID || 'Member', returnURL: process.env.DOCUSIGN_RETURN_URL || 'http://localhost:8080/v2/terms/docusign/returnSigning&envelopeId=<%= envelopeId %>', - assignmentV2TemplateId: 'E12C78DE-67B1-4150-BEC8-C44CE20A2F0B', - w9TemplateId: '8E95BEB4-1C77-4CE2-97C7-5F64A3366370', - w8benTemplateId: 'CD415871-17F5-4A1E-A007-FE416B030FFB', - appirioMutualNDATemplateId: process.env.DOCUSIGN_NDA_TEMPLATE_ID || '19D958E1-E2EC-4828-B270-CA8F14CF7BF4', - affidavitTemplateId: '9103DC77-D8F1-4D7B-BED1-6116604EE98C' + assignmentV2TemplateId: process.env.DOCUSIGN_ASSIGNMENT_V2_TEMPLATE_ID || 'E12C78DE-67B1-4150-BEC8-C44CE20A2F0B', + w9TemplateId: process.env.DOCUSIGN_W9TEMPLATE_ID || '8E95BEB4-1C77-4CE2-97C7-5F64A3366370', + w8benTemplateId: process.env.DOCUSIGN_W8BEN_TEMPLATE_ID || 'CD415871-17F5-4A1E-A007-FE416B030FFB', + appirioMutualNDATemplateId: process.env.DOCUSIGN_NDA_TEMPLATE_ID || '19D958E1-E2EC-4828-B270-CA8F14CF7BF4', + affidavitTemplateId: process.env.DOCUSIGN_AFFIDAVIT_TEMPLATE_ID || '9103DC77-D8F1-4D7B-BED1-6116604EE98C', + assignmentDocTermsOfUseId: process.env.ASSIGNMENT_TERMS_OF_USE_ID || 20753, + callbackFailedEmailSubject: process.env.DOCUSIGN_CALLBACK_FAILED_EMAIL_SUBJECT || 'Processing DocuSign document failed', + callbackConnectKey: process.env.DOCUSIGN_CALLBACK_CONNECT_KEY || 'ABCDED-12435-EDFADSEC', + supportEmailAddress: process.env.DOCUSIGN_CALLBACK_FAILED_SUPPORT_EMAIL_ADDRESS || 'arahant7@yahoo.com', + fromEmailAddress: process.env.DOCUSIGN_CALLBACK_FAILED_FROM_EMAIL_ADDRESS || 'do-not-reply@topcoder.com' }; config.welcomeEmail = { @@ -323,5 +336,4 @@ config.welcomeEmail = { senderName: '[topcoder] API' }; - exports.config = config; diff --git a/deploy/ci.sh b/deploy/ci.sh index daa862b44..74016d8ef 100644 --- a/deploy/ci.sh +++ b/deploy/ci.sh @@ -1,10 +1,16 @@ #!/bin/bash # -# Copyright (C) 2013 TopCoder Inc., All Rights Reserved. +# Copyright (C) 2013-2014 TopCoder Inc., All Rights Reserved. # -# Version: 1.0 -# Author: vangavroche, delemach +# Version: 1.1 +# Author: vangavroche, delemach, isv +# +# changes in 1.1: +# - added RESET_PASSWORD_TOKEN_CACHE_EXPIRY environment variable +# - added RESET_PASSWORD_TOKEN_EMAIL_SUBJECT environment variable +# - added REDIS_HOST environment variable +# - added REDIS_PORT environment variable # export CACHE_EXPIRY=-1 @@ -71,3 +77,10 @@ export GRANT_FORUM_ACCESS=false export DEV_FORUM_JNDI=jnp://env.topcoder.com:1199 export ACTIONHERO_CONFIG=./config.js + +## The period for expiring the generated tokens for password resetting +export RESET_PASSWORD_TOKEN_CACHE_EXPIRY=1800000 +export RESET_PASSWORD_TOKEN_EMAIL_SUBJECT=TopCoder Account Password Reset + +export REDIS_HOST=localhost +export REDIS_PORT=6379 diff --git a/deploy/development.bat b/deploy/development.bat index 6653a7489..b507fef79 100644 --- a/deploy/development.bat +++ b/deploy/development.bat @@ -2,9 +2,15 @@ REM REM Copyright (C) 2014 TopCoder Inc., All Rights Reserved. REM -REM Version: 1.0 -REM Author: TrePe +REM Version: 1.1 +REM Author: TrePe, isv REM +REM Changes in 1.1 +REM - added RESET_PASSWORD_TOKEN_CACHE_EXPIRY environment variable +REM - added RESET_PASSWORD_TOKEN_EMAIL_SUBJECT environment variable +REM - added REDIS_HOST environment variable +REM - added REDIS_PORT environment variable + REM tests rely on caching being off. But set this to a real value (or remove) while coding. @@ -70,3 +76,9 @@ set DEV_FORUM_JNDI=jnp://env.topcoder.com:1199 set ACTIONHERO_CONFIG=./config.js +REM The period for expiring the generated tokens for password resetting (in milliseconds) +set RESET_PASSWORD_TOKEN_CACHE_EXPIRY=15000 +set RESET_PASSWORD_TOKEN_EMAIL_SUBJECT=TopCoder Account Password Reset + +rem set REDIS_HOST=localhost +rem set REDIS_PORT=6379 diff --git a/deploy/development.sh b/deploy/development.sh index e56c3bde2..8e0932419 100755 --- a/deploy/development.sh +++ b/deploy/development.sh @@ -1,18 +1,23 @@ #!/bin/bash # -# Copyright (C) 2013 TopCoder Inc., All Rights Reserved. +# Copyright (C) 2013-2014 TopCoder Inc., All Rights Reserved. # -# Version: 1.1 -# Author: vangavroche, TCSASSEMBLER +# Version: 1.2 +# Author: vangavroche, isv # changes in 1.1: # - add JIRA_USERNAME and JIRA_PASSWORD +# changes in 1.2: +# - added RESET_PASSWORD_TOKEN_CACHE_EXPIRY environment variable +# - added RESET_PASSWORD_TOKEN_EMAIL_SUBJECT environment variable +# - added REDIS_HOST environment variable +# - added REDIS_PORT environment variable # # tests rely on caching being off. But set this to a real value (or remove) while coding. export CACHE_EXPIRY=-1 -VM_IP=informix.cloud.topcoder.com +VM_IP=informix.cloud.topcoder.com if [ -n "$TC_VM_IP" ] then VM_IP=$TC_VM_IP @@ -72,3 +77,10 @@ export GRANT_FORUM_ACCESS=false export DEV_FORUM_JNDI=jnp://env.topcoder.com:1199 export ACTIONHERO_CONFIG=./config.js + +## The period for expiring the generated tokens for password resetting +export RESET_PASSWORD_TOKEN_CACHE_EXPIRY=1800000 +export RESET_PASSWORD_TOKEN_EMAIL_SUBJECT=TopCoder Account Password Reset + +export REDIS_HOST=localhost +export REDIS_PORT=6379 diff --git a/docs/Module Assembly - TopCoder Node JS Generate Reset Token API v1.0.doc b/docs/Module Assembly - TopCoder Node JS Generate Reset Token API v1.0.doc new file mode 100644 index 000000000..4fed4521c Binary files /dev/null and b/docs/Module Assembly - TopCoder Node JS Generate Reset Token API v1.0.doc differ diff --git a/docs/Module Assembly - TopCoder NodeJS Get Marathon Match Challenge Reg Info API.doc b/docs/Module Assembly - TopCoder NodeJS Get Marathon Match Challenge Reg Info API.doc new file mode 100755 index 000000000..89139d80c Binary files /dev/null and b/docs/Module Assembly - TopCoder NodeJS Get Marathon Match Challenge Reg Info API.doc differ diff --git a/docs/Module Assembly - Topcoder NodeJS Docusign Callback API v1.0.doc b/docs/Module Assembly - Topcoder NodeJS Docusign Callback API v1.0.doc new file mode 100644 index 000000000..b4f4844c4 Binary files /dev/null and b/docs/Module Assembly - Topcoder NodeJS Docusign Callback API v1.0.doc differ diff --git a/docusign_callback/Procfile b/docusign_callback/Procfile new file mode 100644 index 000000000..360767d1a --- /dev/null +++ b/docusign_callback/Procfile @@ -0,0 +1 @@ +web: node docusignCallbackListener.js diff --git a/docusign_callback/docusignCallbackListener.js b/docusign_callback/docusignCallbackListener.js new file mode 100644 index 000000000..bc09401ca --- /dev/null +++ b/docusign_callback/docusignCallbackListener.js @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author TCSASSEMBLER + */ +"use strict"; +/*jslint newcap: true */ + +var http = require('http'); +var request = require('request'); +var xpath = require('xpath'); +var dom = require('xmldom').DOMParser; +var url = require('url'); + +/** + * This is the endpoint of the actionhero action for Docusign Callback + */ +var API_ENDPOINT = process.env.DOCUSIGN_CALLBACK_ENDPOINT || 'http://localhost:8080/v2/terms/docusignCallback'; + +/** + * Creates the options object used for making an HTTP request. + * Sets the HTTP method, url, body and the Docusign Authorization header + * @param url The url to set for the HTTP request + * @param method The verb to set for the HTTP request + * @param body The body to set for the HTTP request in case method is POST. It must be a String not an Object. + * @return options the options object for the HTTP request + */ +function initializeRequest(url, method, body) { + var options = { + "method": method, + "uri": url, + "body": body, + "headers": { + "Content-Type": "application/json" + } + }; + return options; +} + +/** + * The standalone pure node.js listener that listens to incoming Docusign Connect xml messages + * It read the xml message, parses the appropriate content, and makes an equivalent POST in JSON to the actionhero docusign callback action + * It then forwards the received response back to Docusign Connect. So in a way it is very much like a proxy. + * @param Function The function that handles the request and response + */ +var server = http.createServer(function (req, resp) { + // Read the XML, convert it into a normal POST request with body and call the docusignCallback action + var body = ''; + req.on('data', function (chunk) { + body += chunk.toString(); + }); + + req.on('end', function () { + var doc = new dom().parseFromString(body), + statusNode = xpath.select('/DocuSignEnvelopeInformation/EnvelopeStatus/Status', doc), + envelopeNode = xpath.select('/DocuSignEnvelopeInformation/EnvelopeStatus/EnvelopeID', doc), + connectKey = url.parse(req.url, true).query.connectKey, + tabStatusNodes = doc.getElementsByTagName('TabStatus'), + envelopeStatus, + envelopeId, + tabs = [], + x, + tabLabelNode, + tabValueNode, + options; + + // Even if status or id is not found, we will call the API with non-trimmed empty string (actionhero rejects a completely empty string) + // This is because we need to log the error as per the current codebase + envelopeStatus = statusNode.length === 0 ? ' ' : statusNode[0].firstChild.data; + envelopeId = envelopeNode.length === 0 ? ' ' : envelopeNode[0].firstChild.data; + + for (x = 0; x < tabStatusNodes.length; x += 1) { + tabLabelNode = tabStatusNodes[x].getElementsByTagName('TabLabel')[0]; + tabValueNode = tabStatusNodes[x].getElementsByTagName('TabValue')[0]; + tabs.push({ + tabLabel: tabLabelNode.hasChildNodes() ? tabLabelNode.firstChild.data : '', + tabValue: tabValueNode.hasChildNodes() ? tabValueNode.firstChild.data : '' + }); + } + + //Now make call to our actionhero docusign callback action + options = initializeRequest(API_ENDPOINT, 'POST', JSON.stringify({ + envelopeStatus: envelopeStatus, + envelopeId: envelopeId, + tabs: tabs, + connectKey: connectKey + })); + request(options, function (err, res, body) { + var statusCode, message, jsonRes = body ? JSON.parse(body) : {}; + + if (err) { + //This can happen only in case of unexpected error such as unable to connect to docusign callback action + statusCode = 500; + message = 'Unable to handle docusign callback. Please try later.'; + } else { + statusCode = res.statusCode; + message = jsonRes.message || ''; + } + resp.writeHead(statusCode, {'Content-Type': 'text/plain'}); + resp.end(message); + }); + }); +}); + +server.listen(process.env.PORT || 8081); diff --git a/docusign_callback/heroku_setup.sh b/docusign_callback/heroku_setup.sh new file mode 100755 index 000000000..ce37d7172 --- /dev/null +++ b/docusign_callback/heroku_setup.sh @@ -0,0 +1,15 @@ +echo "INFO: Creating git repository" +git init +git add . +git commit -m 'auto commit' + +echo "INFO: Creating heroku" +heroku create + +echo "INFO: Set environment variables on heroku" +heroku labs:enable user-env-compile +heroku config:set DOCUSIGN_CALLBACK_ENDPOINT=$DOCUSIGN_CALLBACK_ENDPOINT + +echo "INFO: Push application to heroku and start" +git push heroku master +heroku ps:scale web=1 diff --git a/docusign_callback/kill.sh b/docusign_callback/kill.sh new file mode 100755 index 000000000..c34a6dd34 --- /dev/null +++ b/docusign_callback/kill.sh @@ -0,0 +1,3 @@ +procId=$(ps aux | grep 'node docusignCallbackListener.js' | grep -v grep | awk '{print $2}') +echo "killing $procId" +kill -9 $procId diff --git a/docusign_callback/package.json b/docusign_callback/package.json new file mode 100644 index 000000000..24d92dc00 --- /dev/null +++ b/docusign_callback/package.json @@ -0,0 +1,26 @@ +{ + "name": "docusign_callback", + "version": "0.0.1", + "description": "Standalone listener of incoming messages from Docusign Connect, parses the XML and then forwards to the Docusign Callback actionhero action", + "main": "docusignCallbackListener.js", + "scripts": { + "start": "node docusignCallbackListener.js &", + "test": "node_modules/.bin/mocha test/test.docusignCallbackListener.js" + }, + "engines": { + "node": ">=0.8.0" + }, + "devDependencies": { + "supertest": "0.8.1", + "mocha": "1.13.0", + "chai": "1.8.1" + }, + "author": "", + "dependencies": { + "async": "~0.2.10", + "underscore": "~1.6.0", + "request": "~2.34.0", + "xmldom": "~0.1.19", + "xpath": "0.0.6" + } +} diff --git a/docusign_callback/test/sample.xml b/docusign_callback/test/sample.xml new file mode 100644 index 000000000..b87bb48ad --- /dev/null +++ b/docusign_callback/test/sample.xml @@ -0,0 +1,25 @@ + + + + + + + + Handle + Hung + + + Full Name + firstHung lastHung + + + Email Address + foo@fooonyou.com + + + + + 9e045db0-b50f-11e3-a5e2-0800200c9a66 + Completed + + \ No newline at end of file diff --git a/docusign_callback/test/sqls/informixoltp__clean b/docusign_callback/test/sqls/informixoltp__clean new file mode 100755 index 000000000..33e45ec0b --- /dev/null +++ b/docusign_callback/test/sqls/informixoltp__clean @@ -0,0 +1,2 @@ +DELETE FROM docusign_envelope +WHERE docusign_envelope_id IN ('9E045DB0-B50F-11E3-A5E2-0800200C9A66', '32A09D40-B51E-11E3-A5E2-0800200C9A66', 'AD6212F0-B525-11E3-A5E2-0800200C9A66', '4E0E0DB0-B528-11E3-A5E2-0800200C9A66'); \ No newline at end of file diff --git a/docusign_callback/test/sqls/informixoltp__insert_test_data b/docusign_callback/test/sqls/informixoltp__insert_test_data new file mode 100644 index 000000000..cc17477b5 --- /dev/null +++ b/docusign_callback/test/sqls/informixoltp__insert_test_data @@ -0,0 +1 @@ +INSERT INTO docusign_envelope(docusign_envelope_id, docusign_template_id, user_id, is_completed) VALUES('9E045DB0-B50F-11E3-A5E2-0800200C9A66', 'E12C78DE-67B1-4150-BEC8-C44CE20A2F0B', 124764, 0); \ No newline at end of file diff --git a/docusign_callback/test/test.docusignCallbackListener.js b/docusign_callback/test/test.docusignCallbackListener.js new file mode 100644 index 000000000..72e824da2 --- /dev/null +++ b/docusign_callback/test/test.docusignCallbackListener.js @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author TCSASSEMBLER + */ +"use strict"; +/*global describe, it, before, beforeEach, after, afterEach */ +/*jslint node: true, vars: true, unparam: true, stupid: true */ + +/** + * Module dependencies. + */ +var request = require('supertest'); +var assert = require('chai').assert; +var fs = require('fs'); + +var DOCUSIGN_LISTENER_ENDPOINT = 'http://localhost:8081/'; +var SQL_DIR = __dirname + "/sqls/"; + +/** + * These tests are just to check that the docusignCallbackListener is able to parse the xml and connectKey properly. + * and that it makes calls to the Docusign Callback Action. + * The tests for the Docusign Callback Action are separate and they check the actual functionality and the database state. + */ +describe('Test Docusign Callback Listener', function () { + + /** + * The xml to send in the request + */ + var xmlBody; + + /** + * Creates a Request object for calling the docusign callback listener + * Sets the expected response code using the expectedStatusCode parameter + * @param {Number} expectedStatusCode the expected status code of the response + */ + function getRequest(expectedStatusCode, connectKey) { + var req = request(DOCUSIGN_LISTENER_ENDPOINT + (connectKey ? '?connectKey=' + connectKey : '')) + .post('') + .set('Content-Type', 'text/xml') + .expect('Content-Type', 'text/plain') + .expect(expectedStatusCode); + return req; + } + + + this.timeout(120000); + + /** + * This function is run before all tests. + * @param {Function} done the callback + */ + before(function (done) { + xmlBody = fs.readFileSync(__dirname + '/sample.xml', {encoding: 'utf8'}); + done(); + }); + + /** + * This function is run after all tests. + * @param {Function} done the callback + */ + after(function (done) { + done(); + }); + + /** + * Checks that the response has the correct body + * @param err the error (if any) in the response + * @param resp the response + * @param message the expected message + * @param done the callback to call when we are done + */ + function assertBody(err, resp, expected, done) { + if (err) { + done(err); + return; + } + assert.equal(resp.text, expected); + done(); + } + + /** + * Test docusignCallbackListener when the envelope status node is missing + * should not crash, should make a call to the Docusign Callback Action which will just return 200 and body='Success' + */ + it('should return 200 and body=Success if envelope status node is missing', function (done) { + var req = getRequest(200, 'ABCDED-12435-EDFADSEC'); + var body = xmlBody.replace('Completed', ''); + req.send(body) + .end(function (err, resp) { + assertBody(err, resp, 'success', done); + }); + }); + + /** + * Test docusignCallbackListener when the envelope id node is missing + * should not crash, should make a call to the Docusign Callback Action which will just return 200 and body='Success' + */ + it('should return 200 and body=Success if envelope id node is missing', function (done) { + var req = getRequest(200, 'ABCDED-12435-EDFADSEC'); + var body = xmlBody.replace('abb29293-432b-4cbc-b83c-5338df01f20e', ''); + req.send(body) + .end(function (err, resp) { + assertBody(err, resp, 'success', done); + }); + }); + + /** + * Test docusignCallbackListener when the connectKey is missing or invalid + * should not crash, should make a call to the Docusign Callback Action which will just return 404 and body='Connect Key is missing or invalid.' + */ + it('should return 404 when connect key missing or invalid', function (done) { + var req = getRequest(404, 'ABCDED-12435-EDFADBBB'); + req.send(xmlBody) + .end(function (err, resp) { + assertBody(err, resp, 'Connect Key is missing or invalid.', done); + }); + }); + + /** + * Test docusignCallbackListener when a TabValue is empty + * should not crash + */ + it('should return 200 when a TabValue is empty', function (done) { + var req = getRequest(200, 'ABCDED-12435-EDFADSEC'); + var body = xmlBody.replace('foo@fooonyou.com', ''); + req.send(body) + .end(function (err, resp) { + assertBody(err, resp, 'success', done); + }); + }); +}); + diff --git a/initializers/challengeHelper.js b/initializers/challengeHelper.js index 95d2767d3..360bf5df0 100644 --- a/initializers/challengeHelper.js +++ b/initializers/challengeHelper.js @@ -1,9 +1,14 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.0 - * @author ecnu_haozi + * @version 1.2 + * @author ecnu_haozi, bugbuka, Ghost_141 * Refactor common code out from challenge.js. + * + * changes in 1.1: + * add common function getForumWrapper, aduitResourceAddition + * Changes in 1.2: + * - Add new parameter in getChallengeTerms. */ "use strict"; @@ -14,12 +19,18 @@ var BadRequestError = require('../errors/BadRequestError'); var UnauthorizedError = require('../errors/UnauthorizedError'); var NotFoundError = require('../errors/NotFoundError'); var ForbiddenError = require('../errors/ForbiddenError'); +var ForumWrapper = require("forum-connector").ForumWrapper; /** * This copilot posting project type id */ var COPILOT_POSTING_PROJECT_TYPE = 29; +/** + * The forum wrapper instance + */ +var forumWrapper = null; + /** * Expose the "idGenerator" utility. * @@ -29,16 +40,61 @@ var COPILOT_POSTING_PROJECT_TYPE = 29; exports.challengeHelper = function (api, next) { api.challengeHelper = { + /** + * Get forum wrapper. It is initialized only once. + * @param {Object} api The api object that is used to access the infrastructure. + * @param {Function} callback the callback function + * @since 1.1 + */ + getForumWrapper : function (api, callback) { + if (forumWrapper) { + callback(null, forumWrapper); + } else { + try { + forumWrapper = new ForumWrapper(api.config.general.devForumJNDI); + callback(null, forumWrapper); + } catch (ex) { + api.log('Failed to connect to forum: ' + ex + " " + (ex.stack || ''), 'error'); + callback(new Error('Failed to connect to forum')); + } + } + }, + + /** + * Audit the challenge registration on table 'tcs_catalog.project_user_audit'. + * + * @param {Object} api The api object that is used to access the infrastructure. + * @param {Number} userId The current logged-in user's id. + * @param {Number} challengeId The id of the challenge to register. + * @param {Number} submitterResourceRoleId The id of the submitter resource role. + * @param {Number} auditActionTypeId The id of the audit action type. + * @param {Object} dbConnectionMap The database connection map for the current request. + * @param {Function} next The callback to be called after this function is done. + * @since 1.1 + */ + aduitResourceAddition : function (api, userId, challengeId, submitterResourceRoleId, auditActionTypeId, dbConnectionMap, next) { + api.dataAccess.executeQuery("audit_challenge_registration", { + projectId: challengeId, + resourceUserId: userId, + resourceRoleId: submitterResourceRoleId, + auditActionTypeId: auditActionTypeId, + actionUserId: userId + }, + dbConnectionMap, + next); + }, + /** * Gets the challenge terms for the current user given the challenge id and an optional role. * * @param {Object} connection The connection object for the current request * @param {Number} challengeId The challenge id. * @param {String} role The user's role name, this is optional. + * @param {Boolean} requireRegOpen - the flag that indicate need the challenge has open registration phase or not. * @param {Object} dbConnectionMap The database connection map for the current request * @param {Function} next The callback to be called after this function is done */ - getChallengeTerms : function (connection, challengeId, role, dbConnectionMap, next) { + getChallengeTerms : function (connection, challengeId, role, requireRegOpen, dbConnectionMap, next) { //Check if the user is logged-in if (_.isUndefined(connection.caller) || _.isNull(connection.caller) || @@ -80,7 +136,8 @@ exports.challengeHelper = function (api, next) { return; } - if (!rows[0].reg_open) { + // Update check to use flag. + if (requireRegOpen && !rows[0].reg_open) { cb(new ForbiddenError('Registration Phase of this challenge is not open.')); return; } diff --git a/initializers/helper.js b/initializers/helper.js index 3a10e6288..4c2f90cf9 100644 --- a/initializers/helper.js +++ b/initializers/helper.js @@ -6,7 +6,7 @@ /** * This module contains helper functions. * @author Sky_, Ghost_141, muzehyun, kurtrips, isv, LazyChild, hesibo - * @version 1.20 + * @version 1.22 * changes in 1.1: * - add mapProperties * changes in 1.2: @@ -58,6 +58,10 @@ * - updated softwareChallengeTypes * changes in 1.20 * - added activation code generation function (copied from memberRegistration.js) + * Changes in 1.21: + * - add LIST_TYPE_REGISTRATION_STATUS_MAP and VALID_LIST_TYPE. + * Changes in 1.22: + * - add allTermsAgreed method. */ "use strict"; @@ -153,7 +157,13 @@ var apiName2dbNameMap = { numberofsubmissions: 'number_of_submissions', numberofreviewpositionsavailable: 'number_of_review_positions_available', round2scheduledstartdate: 'round_2_scheduled_start_date', - round1scheduledstartdate: 'round_1_scheduled_start_date' + round1scheduledstartdate: 'round_1_scheduled_start_date', + postingdate: 'posting_date', + numsubmissions: 'num_submissions', + numregistrants: 'num_registrants', + currentphaseremainingtime: 'current_phase_remaining_time', + currentphasename: 'current_phase_name', + registrationopen: 'registration_open' }; /** @@ -305,6 +315,38 @@ var phaseName2Id = _.object(_.values(_.extend(helper.studioChallengeTypes, helpe return [item.name.toLowerCase(), item.phaseId]; })); +/** + * Represents a ListType enum + * @since 1.21 + */ +helper.ListType = { ACTIVE: "ACTIVE", OPEN: "OPEN", UPCOMING: "UPCOMING", PAST: "PAST" }; + +/** + * valid value for listType. + * @since 1.21 + */ +helper.VALID_LIST_TYPE = [helper.ListType.ACTIVE, helper.ListType.OPEN, helper.ListType.UPCOMING, helper.ListType.PAST]; + +/** + * The list type and registration phase status map. + * @since 1.21 + */ +helper.LIST_TYPE_REGISTRATION_STATUS_MAP = {}; +helper.LIST_TYPE_REGISTRATION_STATUS_MAP[helper.ListType.ACTIVE] = [2, 3]; +helper.LIST_TYPE_REGISTRATION_STATUS_MAP[helper.ListType.OPEN] = [2]; +helper.LIST_TYPE_REGISTRATION_STATUS_MAP[helper.ListType.UPCOMING] = [1]; +helper.LIST_TYPE_REGISTRATION_STATUS_MAP[helper.ListType.PAST] = [3]; + +/** + * The list type and project status map. + * @since 1.21 + */ +helper.LIST_TYPE_PROJECT_STATUS_MAP = {}; +helper.LIST_TYPE_PROJECT_STATUS_MAP[helper.ListType.ACTIVE] = [1]; +helper.LIST_TYPE_PROJECT_STATUS_MAP[helper.ListType.OPEN] = [1]; +helper.LIST_TYPE_PROJECT_STATUS_MAP[helper.ListType.UPCOMING] = [2]; +helper.LIST_TYPE_PROJECT_STATUS_MAP[helper.ListType.PAST] = [4, 5, 6, 7, 8, 9, 10, 11]; + /** * Checks whether given object is defined. * @param {Object}obj the obj to check. @@ -887,7 +929,7 @@ helper.checkRefresh = function (connection) { if (!_.contains(ALLOW_FORCE_REFRESH_ACTIONS, connection.action)) { return false; } - return connection.params['refresh'] == 't'; + return connection.params.refresh === 't'; }; /** @@ -1101,7 +1143,7 @@ helper.checkDates = function (startDate, endDate) { */ helper.formatDate = function (date, format) { if (date) { - return moment(date).utc().format(format); + return date.substring(0, format.length); } return ''; }; @@ -1155,6 +1197,19 @@ helper.checkUserExists = function (handle, api, dbConnectionMap, callback) { }); }; +/** + * check if the every terms has been agreed + * + * @param {Array} terms - The terms. + * @returns {Boolean} true if all terms agreed otherwise false. + * @since 1.16 + */ +helper.allTermsAgreed = function (terms) { + return _.every(terms, function (term) { + return term.agreed; + }); +}; + /** * Gets all file types and caches them. * @param {Object} api - the action hero api object @@ -1204,8 +1259,8 @@ function codeRandom(coderId) { } while (oldseed.toNumber() === nextseed.toNumber()); cr.seed = nextseed; return nextseed.shiftRight(16).toNumber(); - } - + }; + return cr; } @@ -1276,7 +1331,7 @@ var getCoderIdFromActivationCode = function (activationCode) { coderId = idhash.substring(0, idhash.length / 2); return coderId; -} +}; helper.getCoderIdFromActivationCode = getCoderIdFromActivationCode; helper.generateActivationCode = generateActivationCode; diff --git a/initializers/ldapHelper.js b/initializers/ldapHelper.js index 6b76cbae5..ab922a797 100644 --- a/initializers/ldapHelper.js +++ b/initializers/ldapHelper.js @@ -218,7 +218,7 @@ var retrieveClient = function (api, client, params, callback) { callback('cannot get client from ldap server', translateLdapError(err)); } - res.on('searchEntry', function(entry) { + res.on('searchEntry', function (entry) { api.log('Successfully retrieve from ldap server', 'info'); var result = { userId: entry.object.uid, @@ -228,15 +228,15 @@ var retrieveClient = function (api, client, params, callback) { callback(null, result); }); - res.on('searchReference', function(referral) { + res.on('searchReference', function (referral) { console.log('referral: ' + referral.uris.join()); }); - res.on('error', function(err) { + res.on('error', function (err) { console.error('error: ' + err.message); }); - res.on('end', function(result) { + res.on('end', function (result) { console.log('status: ' + result.status); }); }); @@ -299,7 +299,7 @@ exports.ldapHelper = function (api, next) { return next(error, null); } }, - + /** * Main function of removeMemberProfileLDAPEntry * @@ -323,8 +323,8 @@ exports.ldapHelper = function (api, next) { function (callback) { removeClient(api, client, userId, callback); } - ], function (err, result) { - + ], function (err) { + if (err) { api.log('removeMemberProfileLDAPEntry: error occurred: ' + err + " " + (err.stack || ''), "error"); } else { @@ -352,7 +352,7 @@ exports.ldapHelper = function (api, next) { // pararms validation - error = api.helper.checkDefined(params['userId'], 'userId'); + error = api.helper.checkDefined(params.userId, 'userId'); if (error) { api.log("activateMemberProfileLDAPEntry: error occurred: " + error + " " + (error.stack || ''), "error"); return next(error, true); @@ -392,7 +392,7 @@ exports.ldapHelper = function (api, next) { var client, error; // pararms validation - error = api.helper.checkDefined(params['userId'], 'userId'); + error = api.helper.checkDefined(params.userId, 'userId'); if (error) { api.log("retrieveMemberProfileLDAPEntry: error occurred: " + error + " " + (error.stack || ''), "error"); return next(error, true); @@ -427,4 +427,4 @@ exports.ldapHelper = function (api, next) { } }; next(); -}; \ No newline at end of file +}; diff --git a/mail_templates/docusign_callback_failure_email/html.ejs b/mail_templates/docusign_callback_failure_email/html.ejs new file mode 100644 index 000000000..42716413d --- /dev/null +++ b/mail_templates/docusign_callback_failure_email/html.ejs @@ -0,0 +1,8 @@ +

+An error happened when processing DocuSign callback. +The support team needs to look into the cause immediately. The details follow.

+userId: <%= userId %>
+templateId: <%= templateId %>
+envelopeId=<%= envelopeId %>
+error: <%= message %> +

\ No newline at end of file diff --git a/mail_templates/docusign_callback_failure_email/style.css b/mail_templates/docusign_callback_failure_email/style.css new file mode 100644 index 000000000..0ad7b8e03 --- /dev/null +++ b/mail_templates/docusign_callback_failure_email/style.css @@ -0,0 +1,8 @@ +p { +display: block; +-webkit-margin-before: 1em; +-webkit-margin-after: 1em; +-webkit-margin-start: 0px; +-webkit-margin-end: 0px; +margin: 1em 0 1em 0; +} diff --git a/mail_templates/docusign_callback_failure_email/text.ejs b/mail_templates/docusign_callback_failure_email/text.ejs new file mode 100644 index 000000000..dca9805ae --- /dev/null +++ b/mail_templates/docusign_callback_failure_email/text.ejs @@ -0,0 +1,10 @@ +An error happened when processing DocuSign callback. +The support team needs to look into the cause immediately. The details follow. + +userId: <%= userId %> + +templateId: <%= templateId %> + +envelopeId=<%= envelopeId %> + +error: <%= message %> \ No newline at end of file diff --git a/mail_templates/reset_token_email/html.ejs b/mail_templates/reset_token_email/html.ejs new file mode 100644 index 000000000..c02976460 --- /dev/null +++ b/mail_templates/reset_token_email/html.ejs @@ -0,0 +1,20 @@ +

+Hi, <%= handle %>, +

+ +

+We have received a request to recover your password. If you requested this, please use the token <%= token %> to continue the process. +

+ +

+The token will expire at <%= expiry %>. +

+ + +

+If you did not make the request and/or believe you got this message in error, please email support@topcoder.com to let us know. +

+ +

+-TopCoder +

\ No newline at end of file diff --git a/mail_templates/reset_token_email/style.css b/mail_templates/reset_token_email/style.css new file mode 100644 index 000000000..05d671dc3 --- /dev/null +++ b/mail_templates/reset_token_email/style.css @@ -0,0 +1 @@ +p {} \ No newline at end of file diff --git a/mail_templates/reset_token_email/text.ejs b/mail_templates/reset_token_email/text.ejs new file mode 100644 index 000000000..f29443f8f --- /dev/null +++ b/mail_templates/reset_token_email/text.ejs @@ -0,0 +1,9 @@ +Hi, <%= handle %>, + +We have received a request to recover your password. If you requested this, please use the token <%= token %> to continue the process. + +The token will expire at <%= expiry %>. + +If you did not make the request and/or believe you got this message in error, please email support@topcoder.com to let us know. + +-TopCoder \ No newline at end of file diff --git a/package.json b/package.json index 41424eef6..d84896042 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "bigdecimal": "0.6.1", "bignum": "0.6.2", "java": "0.2.9", - "informix-wrapper": "git://github.com/cloudspokes/informix-wrapper.git#1b3c12d90dba5b464d2f0a54a11953b1d68dc262", - "forums-wrapper": "git://github.com/cloudspokes/forums-wrapper.git#9066f062e4e2a97b3de89e047a3b022443e7dd83", + "informix-wrapper": "git://github.com/cloudspokes/informix-wrapper.git#ae513d6c27d14acaef52092165831dcf23fc83dd", + "forums-wrapper": "git://github.com/cloudspokes/forums-wrapper.git#98d0db07348a0950924b9ec967bf83769346b700", "asn1": "*", "crypto": ">= 0.0.3", "jsonwebtoken": "*", @@ -40,7 +40,8 @@ "validator": "~3.5.0", "adm-zip": "0.4.4", "mkdirp": "0.3.5", - "archiver": "~0.6.1" + "archiver": "~0.6.1", + "redis": "0.10.1" }, "devDependencies": { "supertest": "0.8.1", diff --git a/queries/challenge_details b/queries/challenge_details index a80e5b354..9575117e0 100755 --- a/queries/challenge_details +++ b/queries/challenge_details @@ -53,7 +53,7 @@ SELECT ELSE 0 END AS current_phase_remaining_time , CASE WHEN pidr.value = 'On' THEN - NVL((SELECT value::decimal FROM project_info pi_dr WHERE pi_dr.project_info_type_id = 30 AND pi_dr.project_id = p.project_id), (SELECT round(NVL(pi16.value::decimal, 0)) FROM project_info pi16 WHERE pi16.project_info_type_id = 16 AND pi16.project_id = p.project_id)) + NVL((SELECT value::decimal FROM project_info pi_dr WHERE pi_dr.project_info_type_id = 30 AND pi_dr.project_id = p.project_id), (SELECT round(NVL(pi16.value::decimal, 1)) FROM project_info pi16 WHERE pi16.project_info_type_id = 16 AND pi16.project_id = p.project_id)) ELSE NULL END AS digital_run_points , pi51.value AS submission_limit , 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) as event_id diff --git a/queries/challenge_unregistration_validations b/queries/challenge_unregistration_validations new file mode 100755 index 000000000..c0e29841d --- /dev/null +++ b/queries/challenge_unregistration_validations @@ -0,0 +1,19 @@ +select distinct + p.project_id, + p.project_category_id as category_id, + (pp_reg_open.project_id IS NOT NULL) as reg_open, + (resource_role_id IS NOT NULL) as user_has_Submitter_resource_role, + CASE WHEN (p.project_studio_spec_id is NULL) THEN 0 ELSE 1 END as is_studio +from project p +-- Check if project's registration is open +left join + project_phase pp_reg_open + on p.project_id = pp_reg_open.project_id + and pp_reg_open.phase_type_id = 1 + and pp_reg_open.phase_status_id = 2 +-- Check if user has Submitter resource role +left join resource rs + on rs.project_id = p.project_id + and rs.resource_role_id = 1 +where p.project_id = @challengeId@; + diff --git a/queries/challenge_unregistration_validations.json b/queries/challenge_unregistration_validations.json new file mode 100755 index 000000000..26e53f27b --- /dev/null +++ b/queries/challenge_unregistration_validations.json @@ -0,0 +1,5 @@ +{ + "name" : "challenge_unregistration_validations", + "db" : "tcs_catalog", + "sqlfile" : "challenge_unregistration_validations" +} diff --git a/queries/check_challenge_review_opportunity b/queries/check_challenge_review_opportunity index a28029561..3ef92f6db 100644 --- a/queries/check_challenge_review_opportunity +++ b/queries/check_challenge_review_opportunity @@ -1,9 +1,9 @@ SELECT 1 FROM project p -INNER JOIN review_auction ra ON ra.project_id = @challengeId@ +INNER JOIN review_auction ra ON ra.project_id = @challenge_id@ INNER JOIN project_category_lu pcl ON pcl.project_category_id = p.project_category_id WHERE 1=1 -AND p.project_id = @challengeId@ +AND p.project_id = @challenge_id@ AND p.project_category_id != 29 -- filter out the copilot posting challenge. AND p.project_category_id != 37 -- filter out the marathon match challenge. AND pcl.display = 't' diff --git a/queries/check_reviewer b/queries/check_reviewer new file mode 100644 index 000000000..224b50774 --- /dev/null +++ b/queries/check_reviewer @@ -0,0 +1,6 @@ +SELECT 1 +FROM rboard_user ru +INNER JOIN project p ON ru.project_type_id = p.project_category_id +WHERE ru.user_id = @user_id@ +AND ru.status_id = 100 +AND p.project_id = @challenge_id@ diff --git a/queries/check_reviewer.json b/queries/check_reviewer.json new file mode 100644 index 000000000..a623c3f00 --- /dev/null +++ b/queries/check_reviewer.json @@ -0,0 +1,5 @@ +{ + "name" : "check_reviewer", + "db" : "tcs_catalog", + "sqlfile" : "check_reviewer" +} diff --git a/queries/complete_docusign_envelope b/queries/complete_docusign_envelope new file mode 100644 index 000000000..9c72e38ca --- /dev/null +++ b/queries/complete_docusign_envelope @@ -0,0 +1,2 @@ +UPDATE docusign_envelope SET is_completed = 1 +WHERE LOWER(docusign_envelope_id) = '@envelopeId@' OR UPPER(docusign_envelope_id) = '@envelopeId@'; \ No newline at end of file diff --git a/queries/complete_docusign_envelope.json b/queries/complete_docusign_envelope.json new file mode 100644 index 000000000..3b757de35 --- /dev/null +++ b/queries/complete_docusign_envelope.json @@ -0,0 +1,5 @@ +{ + "name" : "complete_docusign_envelope", + "db" : "informixoltp", + "sqlfile" : "complete_docusign_envelope" +} \ No newline at end of file diff --git a/queries/delete_challenge_resources b/queries/delete_challenge_resources new file mode 100755 index 000000000..1a24a1fe8 --- /dev/null +++ b/queries/delete_challenge_resources @@ -0,0 +1,3 @@ +DELETE FROM resource_info WHERE resource_id = @resourceId@; +DELETE FROM resource_submission WHERE resource_id = @resourceId@; +DELETE FROM resource WHERE resource_id = @resourceId@; \ No newline at end of file diff --git a/queries/delete_challenge_resources.json b/queries/delete_challenge_resources.json new file mode 100755 index 000000000..feb0dc72a --- /dev/null +++ b/queries/delete_challenge_resources.json @@ -0,0 +1,5 @@ +{ + "name" : "delete_challenge_resources", + "db" : "tcs_catalog", + "sqlfile" : "delete_challenge_resources" +} \ No newline at end of file diff --git a/queries/delete_challenge_result b/queries/delete_challenge_result new file mode 100755 index 000000000..05cadc78a --- /dev/null +++ b/queries/delete_challenge_result @@ -0,0 +1,2 @@ +delete from project_result where project_id = @challengeId@ and user_id = @userId@; +delete from component_inquiry where project_id = @challengeId@ and user_id = @userId@; \ No newline at end of file diff --git a/queries/delete_challenge_result.json b/queries/delete_challenge_result.json new file mode 100755 index 000000000..dab2e2a02 --- /dev/null +++ b/queries/delete_challenge_result.json @@ -0,0 +1,5 @@ +{ + "name" : "delete_challenge_result", + "db" : "tcs_catalog", + "sqlfile" : "delete_challenge_result" +} \ No newline at end of file diff --git a/queries/find_user_by_handle_or_email b/queries/find_user_by_handle_or_email new file mode 100644 index 000000000..8bd0553d2 --- /dev/null +++ b/queries/find_user_by_handle_or_email @@ -0,0 +1,23 @@ +SELECT u.handle, NVL(slp.name, '') AS social_login_provider_name, e.address AS email_address +FROM ( + SELECT u.user_id, 0 + FROM user u + WHERE '' <> '@handle@' + AND u.handle_lower = LOWER('@handle@') + UNION ALL + SELECT e.user_id, 1 + FROM email e + WHERE '' <> '@email@' + AND LOWER(e.address) = LOWER('@email@') + UNION ALL + SELECT s.user_id, 2 + FROM user_social_login s + WHERE '' <> '@handle@' AND LOWER(s.social_user_name) = LOWER('@handle@') + OR + '' <> '@email@' AND LOWER(s.social_email) = LOWER('@email@') + ORDER BY 2 +) tmp +INNER JOIN user u ON u.user_id = tmp.user_id +LEFT JOIN email e ON e.user_id = tmp.user_id +LEFT JOIN user_social_login usl ON usl.user_id = tmp.user_id +LEFT JOIN social_login_provider slp ON slp.social_login_provider_id = usl.social_login_provider_id diff --git a/queries/find_user_by_handle_or_email.json b/queries/find_user_by_handle_or_email.json new file mode 100644 index 000000000..b435c3257 --- /dev/null +++ b/queries/find_user_by_handle_or_email.json @@ -0,0 +1,5 @@ +{ + "name": "find_user_by_handle_or_email", + "db": "common_oltp", + "sqlfile": "find_user_by_handle_or_email" +} \ No newline at end of file diff --git a/queries/get_assigned_review_resource_role b/queries/get_assigned_review_resource_role new file mode 100644 index 000000000..cf9d64f6a --- /dev/null +++ b/queries/get_assigned_review_resource_role @@ -0,0 +1,11 @@ +SELECT + DISTINCT + r.resource_role_id +, u.user_id +FROM resource r +INNER JOIN resource_info ri ON r.resource_id = ri.resource_id AND ri.resource_info_type_id = 1 +INNER JOIN user u ON u.user_id = ri.value +INNER JOIN review_auction ra ON ra.project_id = r.project_id +INNER JOIN review_application_role_lu rarl ON rarl.review_auction_type_id = ra.review_auction_type_id +INNER JOIN review_application_role_resource_role_xref rarrrx ON rarrrx.review_application_role_id = rarl.review_application_role_id AND rarrrx.resource_role_id = r.resource_role_id +WHERE r.project_id = @challenge_id@ diff --git a/queries/get_assigned_review_resource_role.json b/queries/get_assigned_review_resource_role.json new file mode 100644 index 000000000..f2539983e --- /dev/null +++ b/queries/get_assigned_review_resource_role.json @@ -0,0 +1,5 @@ +{ + "name" : "get_assigned_review_resource_role", + "db" : "tcs_catalog", + "sqlfile" : "get_assigned_review_resource_role" +} diff --git a/queries/get_challenge_forum b/queries/get_challenge_forum new file mode 100755 index 000000000..3eb0febdc --- /dev/null +++ b/queries/get_challenge_forum @@ -0,0 +1,8 @@ +SELECT info.project_id, + info_type.name, + info.value as forum_category_id +FROM project_info AS info + JOIN project_info_type_lu AS info_type + ON info.project_info_type_id = info_type.project_info_type_id +WHERE info.project_id IN ( @challengeId@ ) +and name = 'Developer Forum ID' \ No newline at end of file diff --git a/queries/get_challenge_forum.json b/queries/get_challenge_forum.json new file mode 100755 index 000000000..5bc8ff225 --- /dev/null +++ b/queries/get_challenge_forum.json @@ -0,0 +1,5 @@ +{ + "name" : "get_challenge_forum", + "db" : "tcs_catalog", + "sqlfile" : "get_challenge_forum" +} \ No newline at end of file diff --git a/queries/get_docusign_envelope b/queries/get_docusign_envelope index 42a1b0342..9924cd671 100644 --- a/queries/get_docusign_envelope +++ b/queries/get_docusign_envelope @@ -1,4 +1,5 @@ SELECT * FROM docusign_envelope WHERE user_id = @userId@ -AND docusign_template_id = '@templateId@' \ No newline at end of file +AND docusign_template_id = '@templateId@' +AND is_completed = 1 \ No newline at end of file diff --git a/queries/get_docusign_envelope_by_envelope_id b/queries/get_docusign_envelope_by_envelope_id new file mode 100644 index 000000000..b6a359b3d --- /dev/null +++ b/queries/get_docusign_envelope_by_envelope_id @@ -0,0 +1,3 @@ +SELECT * +FROM docusign_envelope +WHERE LOWER(docusign_envelope_id) = '@envelopeId@' OR UPPER(docusign_envelope_id) = '@envelopeId@'; \ No newline at end of file diff --git a/queries/get_docusign_envelope_by_envelope_id.json b/queries/get_docusign_envelope_by_envelope_id.json new file mode 100644 index 000000000..fd8ae74d4 --- /dev/null +++ b/queries/get_docusign_envelope_by_envelope_id.json @@ -0,0 +1,5 @@ +{ + "name" : "get_docusign_envelope_by_envelope_id", + "db" : "informixoltp", + "sqlfile" : "get_docusign_envelope_by_envelope_id" +} \ No newline at end of file diff --git a/queries/get_marathon_round_question_answers b/queries/get_marathon_round_question_answers new file mode 100755 index 000000000..6c01e689a --- /dev/null +++ b/queries/get_marathon_round_question_answers @@ -0,0 +1,9 @@ +SELECT + answer_id, + question_id, + answer_text AS text, + sort_order, + NVL(correct, 0) AS correct +FROM answer +WHERE question_id IN (@question_ids@) +ORDER BY sort_order \ No newline at end of file diff --git a/queries/get_marathon_round_question_answers.json b/queries/get_marathon_round_question_answers.json new file mode 100755 index 000000000..9d37d1c0a --- /dev/null +++ b/queries/get_marathon_round_question_answers.json @@ -0,0 +1,5 @@ +{ + "name" : "get_marathon_round_question_answers", + "db" : "informixoltp", + "sqlfile" : "get_marathon_round_question_answers" +} \ No newline at end of file diff --git a/queries/get_marathon_round_questions b/queries/get_marathon_round_questions new file mode 100755 index 000000000..12119e5b6 --- /dev/null +++ b/queries/get_marathon_round_questions @@ -0,0 +1,15 @@ +SELECT + qu.question_id, + qs.question_style_desc AS style, + qt.question_type_desc AS type, + qu.question_text AS text +FROM + round_question rq, + question qu, + question_style qs, + question_type qt +WHERE rq.question_id = qu.question_id + AND rq.round_id = @round_id@ + AND qs.question_style_id = qu.question_style_id + AND qt.question_type_id = qu.question_type_id +ORDER BY qu.question_id \ No newline at end of file diff --git a/queries/get_marathon_round_questions.json b/queries/get_marathon_round_questions.json new file mode 100755 index 000000000..2c0309b39 --- /dev/null +++ b/queries/get_marathon_round_questions.json @@ -0,0 +1,5 @@ +{ + "name" : "get_marathon_round_questions", + "db" : "informixoltp", + "sqlfile" : "get_marathon_round_questions" +} \ No newline at end of file diff --git a/queries/get_marathon_round_term b/queries/get_marathon_round_term new file mode 100755 index 000000000..1cfbbc957 --- /dev/null +++ b/queries/get_marathon_round_term @@ -0,0 +1,11 @@ +SELECT + terms_content, + ct.name AS contest_name, + rd.name AS round_name +FROM + round_terms rt, + round rd, + contest ct +WHERE rt.round_id = @round_id@ + AND rt.round_id = rd.round_id + AND rd.contest_id = ct.contest_id \ No newline at end of file diff --git a/queries/get_marathon_round_term.json b/queries/get_marathon_round_term.json new file mode 100755 index 000000000..a79c793e9 --- /dev/null +++ b/queries/get_marathon_round_term.json @@ -0,0 +1,5 @@ +{ + "name" : "get_marathon_round_term", + "db" : "informixoltp", + "sqlfile" : "get_marathon_round_term" +} \ No newline at end of file diff --git a/queries/get_next_sequence_tcs_catalog b/queries/get_next_sequence_tcs_catalog new file mode 100644 index 000000000..edfd2117f --- /dev/null +++ b/queries/get_next_sequence_tcs_catalog @@ -0,0 +1 @@ +select SEQUENCE_@seq_name@.NEXTVAL as next_id from table(set{1}) diff --git a/queries/get_next_sequence_tcs_catalog.json b/queries/get_next_sequence_tcs_catalog.json new file mode 100644 index 000000000..9f4a0a275 --- /dev/null +++ b/queries/get_next_sequence_tcs_catalog.json @@ -0,0 +1,5 @@ +{ + "name" : "get_next_sequence_tcs_catalog", + "db" : "tcs_catalog", + "sqlfile" : "get_next_sequence_tcs_catalog" +} diff --git a/queries/get_open_data_challenges_rss b/queries/get_open_data_challenges_rss new file mode 100644 index 000000000..dda83d91a --- /dev/null +++ b/queries/get_open_data_challenges_rss @@ -0,0 +1,16 @@ +SELECT +FIRST @page_size@ + r.round_id AS challenge_id +, ct.name AS challenge_name +, ct.name AS detailed_requirements +, 'marathon' AS challenge_type +FROM + round_segment rs +, round r +, contest ct +WHERE rs.round_id = r.round_id +AND ct.contest_id = r.contest_id +AND rs.segment_id = 2 +AND r.round_type_id IN (13,15,19,22,24,25,27) +AND CURRENT < rs.end_time +AND CURRENT >= rs.start_time diff --git a/queries/get_open_data_challenges_rss.json b/queries/get_open_data_challenges_rss.json new file mode 100644 index 000000000..d445afe8a --- /dev/null +++ b/queries/get_open_data_challenges_rss.json @@ -0,0 +1,5 @@ +{ + "name" : "get_open_data_challenges_rss", + "db" : "informixoltp", + "sqlfile" : "get_open_data_challenges_rss" +} diff --git a/queries/get_past_data_challenges_rss b/queries/get_past_data_challenges_rss new file mode 100644 index 000000000..4a256ef07 --- /dev/null +++ b/queries/get_past_data_challenges_rss @@ -0,0 +1,35 @@ +SELECT +FIRST @page_size@ * +FROM +( + -- past marathon match challenges. + SELECT + 'marathon' AS challenge_type + , c.name AS challenge_name + , c.name AS detailed_requirements + , r.round_id AS challenge_id + FROM + round r + , contest c + , long_comp_result lcr + WHERE r.contest_id = c.contest_id + AND r.round_type_id IN (10,13,15,19,22,24,25,27) + AND r.failed = 0 + AND r.round_id = lcr.round_id + AND lcr.attended = 'Y' + AND lcr.placed = 1 + AND c.end_date >= current + + UNION ALL + + -- past srm challenges. + SELECT + 'algorithm' AS challenge_type + , r.short_name AS challenge_name + , r.short_name AS detailed_requirements + , r.round_id AS challenge_id + FROM contest c + JOIN round AS r ON r.contest_id = c.contest_id AND r.failed = 0 AND r.status='A' + WHERE r.round_type_id in (1, 2, 10) + AND c.end_date >= current +) diff --git a/queries/get_past_data_challenges_rss.json b/queries/get_past_data_challenges_rss.json new file mode 100644 index 000000000..9c299caea --- /dev/null +++ b/queries/get_past_data_challenges_rss.json @@ -0,0 +1,5 @@ +{ + "name" : "get_past_data_challenges_rss", + "db" : "topcoder_dw", + "sqlfile" : "get_past_data_challenges_rss" +} diff --git a/queries/get_review_opportunity_detail_applications b/queries/get_review_opportunity_detail_applications index c30d3887c..f9e56ab7f 100644 --- a/queries/get_review_opportunity_detail_applications +++ b/queries/get_review_opportunity_detail_applications @@ -1,7 +1,6 @@ SELECT u.handle , rarl.name AS role -, rarl.review_application_role_id AS role_id , ratingTable.rating AS reviewer_rating , rasl.name AS status , ra.create_date AS application_date @@ -10,7 +9,7 @@ INNER JOIN user u ON u.user_id = ra.user_id INNER JOIN review_auction rauc ON rauc.review_auction_id = ra.review_auction_id INNER JOIN review_application_role_lu rarl ON rarl.review_application_role_id = ra.review_application_role_id INNER JOIN review_application_status_lu rasl ON rasl.review_application_status_id = ra.review_application_status_id -INNER JOIN project p ON p.project_id = @challengeId@ AND p.project_id = rauc.project_id +INNER JOIN project p ON p.project_id = @challenge_id@ AND p.project_id = rauc.project_id LEFT OUTER JOIN ( SELECT DISTINCT @@ -18,16 +17,16 @@ LEFT OUTER JOIN ( , rr.user_id , rr.review_date FROM reviewer_rating rr - INNER JOIN project p1 ON p1.project_id = @challengeId@ + INNER JOIN project p1 ON p1.project_id = @challenge_id@ INNER JOIN project p2 ON p2.project_id = rr.project_id WHERE 1=1 AND p1.project_category_id = p2.project_category_id AND review_date = (SELECT max(rr.review_date) FROM reviewer_rating rr - INNER JOIN project p1 ON p1.project_id = @challengeId@ + INNER JOIN project p1 ON p1.project_id = @challenge_id@ INNER JOIN project p2 ON p2.project_id = rr.project_id WHERE 1=1 AND p1.project_category_id = p2.project_category_id) ) ratingTable ON ratingTable.user_id = u.user_id -ORDER BY ra.create_date ASC \ No newline at end of file +ORDER BY ra.create_date ASC diff --git a/queries/get_review_opportunity_detail_basic b/queries/get_review_opportunity_detail_basic index 85c642a0e..ec4025c42 100644 --- a/queries/get_review_opportunity_detail_basic +++ b/queries/get_review_opportunity_detail_basic @@ -7,6 +7,7 @@ SELECT , 1 - (SELECT count(r.resource_id) FROM resource r WHERE r.project_id=p.project_id AND r.resource_role_id = 18) AS reviewers_required , rarl.review_application_role_id , dpp.resource_role_id +, rarrrx.unique_role AS is_unique , dpp.fixed_amount , dpp.base_coefficient , dpp.incremental_coefficient @@ -24,7 +25,7 @@ SELECT END AS submission_count FROM review_auction ra INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=2 -INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = @challengeId@ +INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = @challenge_id@ INNER JOIN project_category_lu pcl ON p.project_category_id = pcl.project_category_id INNER JOIN project_info pi ON pi.project_id = p.project_id AND pi.project_info_type_id = 6 INNER JOIN project_phase pp13 ON pp13.project_id=p.project_id AND pp13.phase_type_id=13 AND not exists (SELECT 1 FROM phase_dependency WHERE dependent_phase_id=pp13.project_phase_id) @@ -45,6 +46,7 @@ SELECT , pc.parameter::int - (SELECT count(r.resource_id) FROM resource r WHERE r.project_id=p.project_id AND r.resource_role_id IN (4,5,6,7)) AS reviewers_required , rarl.review_application_role_id , dpp.resource_role_id +, rarrrx.unique_role AS is_unique , dpp.fixed_amount , dpp.base_coefficient , dpp.incremental_coefficient @@ -62,7 +64,7 @@ SELECT END AS submission_count FROM review_auction ra INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=1 -INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = @challengeId@ +INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = @challenge_id@ INNER JOIN project_category_lu pcl ON p.project_category_id = pcl.project_category_id INNER JOIN project_info pi ON pi.project_id = p.project_id AND pi.project_info_type_id = 6 INNER JOIN project_phase pp2 ON pp2.project_id=p.project_id AND pp2.phase_type_id=2 @@ -83,6 +85,7 @@ SELECT , pc.parameter::int - (SELECT count(r.resource_id) FROM resource r WHERE r.project_id=p.project_id AND r.resource_role_id = 21) AS reviewers_required , rarl.review_application_role_id , dpp.resource_role_id +, rarrrx.unique_role AS is_unique , dpp.fixed_amount , dpp.base_coefficient , dpp.incremental_coefficient @@ -100,7 +103,7 @@ SELECT END AS submission_count FROM review_auction ra INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=3 -INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = @challengeId@ +INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = @challenge_id@ INNER JOIN project_category_lu pcl ON p.project_category_id = pcl.project_category_id INNER JOIN project_info pi ON pi.project_id = p.project_id AND pi.project_info_type_id = 6 INNER JOIN project_phase pp2 ON pp2.project_id=p.project_id AND pp2.phase_type_id=2 @@ -110,4 +113,4 @@ INNER JOIN phase_criteria pc ON pc.project_phase_id=pp18.project_phase_id AND pc INNER JOIN review_application_role_lu rarl ON rarl.review_auction_type_id = ra.review_auction_type_id INNER JOIN review_application_role_resource_role_xref rarrrx ON rarrrx.review_application_role_id = rarl.review_application_role_id INNER JOIN default_project_payment dpp ON dpp.resource_role_id = rarrrx.resource_role_id AND p.project_category_id = dpp.project_category_id -WHERE dpp.resource_role_id = 21 \ No newline at end of file +WHERE dpp.resource_role_id = 21 diff --git a/queries/get_review_opportunity_detail_phases b/queries/get_review_opportunity_detail_phases index 7fb37486a..a3a584187 100644 --- a/queries/get_review_opportunity_detail_phases +++ b/queries/get_review_opportunity_detail_phases @@ -8,5 +8,5 @@ SELECT FROM project_phase pp INNER JOIN phase_status_lu psl ON psl.phase_status_id = pp.phase_status_id INNER JOIN phase_type_lu ptl ON ptl.phase_type_id = pp.phase_type_id -WHERE pp.project_id = @challengeId@ -ORDER BY NVL(actual_start_time, scheduled_start_time) ASC \ No newline at end of file +WHERE pp.project_id = @challenge_id@ +ORDER BY NVL(actual_start_time, scheduled_start_time) ASC diff --git a/queries/get_review_opportunity_detail_positions b/queries/get_review_opportunity_detail_positions index 7d504989e..c8bcae8fc 100644 --- a/queries/get_review_opportunity_detail_positions +++ b/queries/get_review_opportunity_detail_positions @@ -2,7 +2,9 @@ SELECT rarl.name AS role , rarl.review_application_role_id , rarl.positions AS num_positions +, rarl.order_index FROM review_auction ra -INNER JOIN project p ON p.project_id = @challengeId@ AND ra.project_id = @challengeId@ +INNER JOIN project p ON p.project_id = @challenge_id@ AND ra.project_id = @challenge_id@ INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id = ra.review_auction_type_id INNER JOIN review_application_role_lu rarl ON rarl.review_auction_type_id = ra.review_auction_type_id +ORDER BY rarl.order_index ASC diff --git a/queries/get_software_studio_challenges_rss b/queries/get_software_studio_challenges_rss new file mode 100644 index 000000000..545aff4d2 --- /dev/null +++ b/queries/get_software_studio_challenges_rss @@ -0,0 +1,19 @@ +SELECT +FIRST @page_size@ + pcl.name AS challenge_type +, pi.value AS challenge_name +, p.project_id AS challenge_id +, p.tc_direct_project_id AS project_id +, ps.detailed_requirements_text AS software_detailed_requirements +, sps.contest_description_text AS studio_detailed_requirements +FROM project p +INNER JOIN project_category_lu pcl ON pcl.project_category_id = p.project_category_id +INNER JOIN project_info pi ON pi.project_info_type_id = 6 AND p.project_id = pi.project_id +INNER JOIN project_phase pp1 ON pp1.project_id = p.project_id AND pp1.phase_type_id = 1 +LEFT JOIN project_spec ps ON ps.project_id = p.project_id +LEFT JOIN project_studio_specification sps ON sps.project_studio_spec_id = p.project_studio_spec_id +WHERE 1=1 +AND p.project_status_id IN (@project_status_id@) +AND pcl.project_type_id IN (@project_type_id@) +AND pp1.phase_status_id IN (@registration_phase_status@) +AND p.project_category_id NOT IN (27, 37) diff --git a/queries/get_software_studio_challenges_rss.json b/queries/get_software_studio_challenges_rss.json new file mode 100644 index 000000000..959171051 --- /dev/null +++ b/queries/get_software_studio_challenges_rss.json @@ -0,0 +1,5 @@ +{ + "name" : "get_software_studio_challenges_rss", + "db" : "tcs_catalog", + "sqlfile" : "get_software_studio_challenges_rss" +} 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/queries/get_user_challenge_resource b/queries/get_user_challenge_resource new file mode 100755 index 000000000..2c009b357 --- /dev/null +++ b/queries/get_user_challenge_resource @@ -0,0 +1,13 @@ +SELECT DISTINCT + resource_info_type_lu.resource_info_type_id, + resource_info.value as user_id, + resource.resource_id AS resource_id, + resource_role_id + FROM resource, + resource_info, + resource_info_type_lu +WHERE resource.resource_id = resource_info.resource_id + AND resource_info.resource_info_type_id = resource_info_type_lu.resource_info_type_id + AND project_id = @challengeId@ + AND resource_info_type_lu.resource_info_type_id = 1 -- External Reference ID + AND resource_info.value = '@userId@' \ No newline at end of file diff --git a/queries/get_user_challenge_resource.json b/queries/get_user_challenge_resource.json new file mode 100755 index 000000000..9db744c64 --- /dev/null +++ b/queries/get_user_challenge_resource.json @@ -0,0 +1,5 @@ +{ +"name" : "get_user_challenge_resource", +"db" : "tcs_catalog", +"sqlfile" : "get_user_challenge_resource" +} \ No newline at end of file diff --git a/queries/get_user_review_applications b/queries/get_user_review_applications new file mode 100644 index 000000000..bc43ec19a --- /dev/null +++ b/queries/get_user_review_applications @@ -0,0 +1,12 @@ +SELECT + rarl.name AS role +, rarl.review_application_role_id AS role_id +, ra.review_application_id +, rasl.name AS status +FROM review_application ra +INNER JOIN user u ON u.user_id = ra.user_id +INNER JOIN review_auction rauc ON rauc.review_auction_id = ra.review_auction_id AND rauc.project_id = @challenge_id@ +INNER JOIN review_application_role_lu rarl ON rarl.review_application_role_id = ra.review_application_role_id +INNER JOIN review_application_status_lu rasl ON rasl.review_application_status_id = ra.review_application_status_id +WHERE u.user_id = @user_id@ +ORDER BY ra.create_date ASC diff --git a/queries/get_user_review_applications.json b/queries/get_user_review_applications.json new file mode 100644 index 000000000..b20108687 --- /dev/null +++ b/queries/get_user_review_applications.json @@ -0,0 +1,5 @@ +{ + "name" : "get_user_review_applications", + "db" : "tcs_catalog", + "sqlfile" : "get_user_review_applications" +} diff --git a/queries/insert_resource b/queries/insert_resource index 90ce4de75..f67ea0ea3 100644 --- a/queries/insert_resource +++ b/queries/insert_resource @@ -1,5 +1,5 @@ INSERT INTO resource - ( resource_id, + ( resource_id, resource_role_id, project_id, user_id, diff --git a/queries/insert_review_application b/queries/insert_review_application new file mode 100644 index 000000000..f7917bf63 --- /dev/null +++ b/queries/insert_review_application @@ -0,0 +1,2 @@ +INSERT INTO review_application(review_application_id, user_id, review_auction_id, review_application_role_id, review_application_status_id, create_date, modify_date) +VALUES(@review_application_id@, @user_id@, @review_auction_id@, @role_id@, @status@, current, current) diff --git a/queries/insert_review_application.json b/queries/insert_review_application.json new file mode 100644 index 000000000..31fc756ee --- /dev/null +++ b/queries/insert_review_application.json @@ -0,0 +1,5 @@ +{ + "name" : "insert_review_application", + "db" : "tcs_catalog", + "sqlfile" : "insert_review_application" +} diff --git a/queries/insert_user b/queries/insert_user index 91e80f9e2..7373ab8f8 100644 --- a/queries/insert_user +++ b/queries/insert_user @@ -1,2 +1,2 @@ -INSERT INTO user(user_id, first_name, last_name, handle, status, activation_code, reg_source) -VALUES (@userId@, '@firstName@', '@lastName@', '@handle@', '@status@', '@activationCode@', '@regSource@') \ No newline at end of file +INSERT INTO user(user_id, first_name, last_name, handle, status, activation_code, reg_source, utm_source, utm_medium, utm_campaign) +VALUES (@userId@, '@firstName@', '@lastName@', '@handle@', '@status@', '@activationCode@', '@regSource@', '@utm_source@', '@utm_medium@', '@utm_campaign@') \ No newline at end of file diff --git a/queries/review_opportunity_detail b/queries/review_opportunity_detail new file mode 100644 index 000000000..1b4160915 --- /dev/null +++ b/queries/review_opportunity_detail @@ -0,0 +1,86 @@ +-- spec +SELECT + ra.review_auction_id +, 1 - (SELECT COUNT(r.resource_id) FROM resource r WHERE r.project_id=p.project_id AND r.resource_role_id = 18) AS positions_left +, rarl.name AS role_name +, rarl.review_application_role_id +, rarl.positions +, rarl.order_index +, rrl.name AS resource_role_name +, rrl.resource_role_id +, nvl(pp13.actual_start_time,pp13.scheduled_start_time) + 1 units hour AS assignment_date +, rarrrx.unique_role AS is_unique +FROM review_auction ra +INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=2 +INNER JOIN review_application_role_lu rarl ON rarl.review_auction_type_id = ra.review_auction_type_id +INNER JOIN review_application_role_resource_role_xref rarrrx ON rarrrx.review_application_role_id = rarl.review_application_role_id +INNER JOIN resource_role_lu rrl ON rrl.resource_role_id = rarrrx.resource_role_id +INNER JOIN project p ON p.project_id=ra.project_id +INNER JOIN project_phase pp13 ON pp13.project_id=p.project_id AND pp13.phase_type_id=13 AND not exists (SELECT 1 FROM phase_dependency WHERE dependent_phase_id=pp13.project_phase_id) +INNER JOIN phase_dependency pd ON pd.dependency_phase_id=pp13.project_phase_id +INNER JOIN project_phase pp14 ON pp14.project_id=p.project_id AND pp14.phase_type_id=14 AND pp14.project_phase_id=pd.dependent_phase_id +WHERE p.project_id = @challenge_id@ +AND p.project_status_id = 1 +AND pp13.phase_status_id IN (2, 3) +AND pp14.phase_status_id IN (1, 2) + +UNION ALL + +-- contest +SELECT + ra.review_auction_id +, pc.parameter::int - (SELECT COUNT(r.resource_id) FROM resource r WHERE r.project_id=p.project_id AND r.resource_role_id IN (4,5,6,7)) AS positions_left +, rarl.name AS role_name +, rarl.review_application_role_id +, rarl.positions +, rarl.order_index +, rrl.name AS resource_role_name +, rrl.resource_role_id +, nvl(pp2.actual_end_time,pp2.scheduled_end_time) - 24 units hour AS assignment_date +, rarrrx.unique_role AS is_unique +FROM review_auction ra +INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=1 +INNER JOIN review_application_role_lu rarl ON rarl.review_auction_type_id = ra.review_auction_type_id +INNER JOIN review_application_role_resource_role_xref rarrrx ON rarrrx.review_application_role_id = rarl.review_application_role_id +INNER JOIN resource_role_lu rrl ON rrl.resource_role_id = rarrrx.resource_role_id +INNER JOIN project p ON p.project_id=ra.project_id +INNER JOIN project_phase pp2 ON pp2.project_id=p.project_id AND pp2.phase_type_id=2 +INNER JOIN project_phase pp4 ON pp4.project_id=p.project_id AND pp4.phase_type_id=4 +INNER JOIN phase_criteria pc ON pc.project_phase_id=pp4.project_phase_id AND pc.phase_criteria_type_id=6 +WHERE p.project_id = @challenge_id@ +AND p.project_status_id = 1 +AND pp2.phase_status_id IN (2, 3) +AND pp4.phase_status_id IN (1, 2) +AND not exists (SELECT 1 FROM project_phase pp12 WHERE pp12.project_id=p.project_id AND pp12.phase_type_id=12) + +UNION ALL + +-- iterative +SELECT + ra.review_auction_id +, pc.parameter::int - (SELECT COUNT(r.resource_id) FROM resource r WHERE r.project_id=p.project_id AND r.resource_role_id = 21) AS positions_left +, rarl.name AS role_name +, rarl.review_application_role_id +, rarl.positions +, rarl.order_index +, rrl.name AS resource_role_name +, rrl.resource_role_id +, nvl(pp2.actual_start_time,pp2.scheduled_start_time) + 24 units hour AS assignment_date +, rarrrx.unique_role AS is_unique +FROM review_auction ra +INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=3 +INNER JOIN review_application_role_lu rarl ON rarl.review_auction_type_id = ra.review_auction_type_id +INNER JOIN review_application_role_resource_role_xref rarrrx ON rarrrx.review_application_role_id = rarl.review_application_role_id +INNER JOIN resource_role_lu rrl ON rrl.resource_role_id = rarrrx.resource_role_id +INNER JOIN project p ON p.project_id=ra.project_id +INNER JOIN project_phase pp2 ON pp2.project_id=p.project_id AND pp2.phase_type_id=2 +INNER JOIN project_phase pp18 ON pp18.project_id=p.project_id AND pp18.phase_type_id=18 +INNER JOIN phase_dependency pd ON pd.dependent_phase_id=pp18.project_phase_id AND pd.dependent_start=1 AND pd.dependency_phase_id=pp2.project_phase_id AND pd.dependency_start=1 +INNER JOIN phase_criteria pc ON pc.project_phase_id=pp18.project_phase_id AND pc.phase_criteria_type_id=6 +WHERE p.project_id = @challenge_id@ +AND p.project_status_id = 1 +AND pp2.phase_status_id IN (2, 3) +AND pp18.phase_status_id IN (1, 2) +AND not exists (SELECT 1 FROM project_phase pp12 WHERE pp12.project_id=p.project_id AND pp12.phase_type_id=12) + +ORDER BY rarl.order_index ASC diff --git a/queries/review_opportunity_detail.json b/queries/review_opportunity_detail.json new file mode 100644 index 000000000..447184819 --- /dev/null +++ b/queries/review_opportunity_detail.json @@ -0,0 +1,5 @@ +{ + "name" : "review_opportunity_detail", + "db" : "tcs_catalog", + "sqlfile" : "review_opportunity_detail" +} diff --git a/queries/search_private_software_studio_challenges b/queries/search_private_software_studio_challenges index 7d0c2f8ee..bf5807c54 100644 --- a/queries/search_private_software_studio_challenges +++ b/queries/search_private_software_studio_challenges @@ -113,22 +113,13 @@ LEFT OUTER JOIN ( WHERE pp4.phase_type_id = 4 AND pc4.phase_criteria_type_id = 1 ) review ON review.project_id = p.project_id -LEFT OUTER JOIN ( - SELECT - scheduled_end_time - , actual_end_time - , phase_type_id - , pp.project_id - FROM project p - LEFT OUTER JOIN project_phase pp ON pp.project_id = p.project_id - WHERE project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase pp WHERE pp.project_id = p.project_id AND pp.phase_status_id = 2 AND pp.phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) -) nd_phase ON nd_phase.project_id = p.project_id INNER JOIN project_phase pp1 ON pp1.project_id = p.project_id AND pp1.phase_type_id = 1 INNER JOIN project_status_lu pstatus ON p.project_status_id = pstatus.project_status_id +LEFT OUTER JOIN project_phase nd_phase ON p.project_Id = nd_phase.project_id , project_category_lu pcl WHERE 1=1 AND p.project_category_id = pcl.project_category_id --- Filter the private challenge +-- Filter out the challenge that user is not belong to. AND p.project_id IN (SELECT contest_id FROM contest_eligibility ce @@ -139,12 +130,14 @@ AND pcl.project_category_id NOT IN (27, 37) --exclude when spec review was a 'co AND p.project_status_id IN (@project_status_id@) AND pcl.project_type_id IN (@project_type_id@) AND pp1.phase_status_id IN (@registration_phase_status@) -AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') +AND nd_phase.project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase WHERE project_id = p.project_id AND phase_status_id = 2 AND phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) +AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') AND LOWER(pcl.description) = DECODE('@categoryName@', '', LOWER(pcl.description), '@categoryName@') AND LOWER(pi.challenge_name) LIKE ('@challengeName@') AND NVL(pr.prize1, 0) >= @prilower@ AND NVL(pr.prize1, 0) <= @priupper@ AND p.tc_direct_project_id = DECODE(@tcdirectid@, 0, p.tc_direct_project_id, @tcdirectid@) AND NVL(LOWER(pi.cmc_task_id), '') = DECODE('@cmc@', '', NVL(LOWER(pi.cmc_task_id), ''), '@cmc@') + ORDER BY @sortColumn@ @sortOrder@ diff --git a/queries/search_private_software_studio_challenges_count b/queries/search_private_software_studio_challenges_count index 7aafec6a8..679ce5c45 100644 --- a/queries/search_private_software_studio_challenges_count +++ b/queries/search_private_software_studio_challenges_count @@ -1,5 +1,5 @@ SELECT - COUNT(*) AS total + COUNT(DISTINCT p.project_id) AS total FROM project p LEFT JOIN ( SELECT @@ -67,22 +67,13 @@ LEFT OUTER JOIN ( WHERE pp4.phase_type_id = 4 AND pc4.phase_criteria_type_id = 1 ) review ON review.project_id = p.project_id -LEFT OUTER JOIN ( - SELECT - scheduled_end_time - , actual_end_time - , phase_type_id - , pp.project_id - FROM project p - LEFT OUTER JOIN project_phase pp ON pp.project_id = p.project_id - WHERE project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase pp WHERE pp.project_id = p.project_id AND pp.phase_status_id = 2 AND pp.phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) -) nd_phase ON nd_phase.project_id = p.project_id INNER JOIN project_phase pp1 ON pp1.project_id = p.project_id AND pp1.phase_type_id = 1 INNER JOIN project_status_lu pstatus ON p.project_status_id = pstatus.project_status_id +LEFT OUTER JOIN project_phase nd_phase ON p.project_Id = nd_phase.project_id , project_category_lu pcl WHERE 1=1 AND p.project_category_id = pcl.project_category_id --- Filter the private challenge +-- Filter out the challenge that user is not belong to. AND p.project_id IN (SELECT contest_id FROM contest_eligibility ce @@ -93,8 +84,9 @@ AND pcl.project_category_id NOT IN (27, 37) --exclude when spec review was a 'co AND p.project_status_id IN (@project_status_id@) AND pcl.project_type_id IN (@project_type_id@) AND pp1.phase_status_id IN (@registration_phase_status@) -AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') +AND nd_phase.project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase WHERE project_id = p.project_id AND phase_status_id = 2 AND phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) +AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') AND LOWER(pcl.description) = DECODE('@categoryName@', '', LOWER(pcl.description), '@categoryName@') AND LOWER(pi.challenge_name) LIKE ('@challengeName@') AND NVL(pr.prize1, 0) >= @prilower@ diff --git a/queries/search_software_review_opportunities_adjust_payment b/queries/search_software_review_opportunities_adjust_payment index f1fe206cb..09a9b52f7 100644 --- a/queries/search_software_review_opportunities_adjust_payment +++ b/queries/search_software_review_opportunities_adjust_payment @@ -8,7 +8,7 @@ DISTINCT FROM project_payment_adjustment ppa INNER JOIN review_auction ra ON ra.project_id = ppa.project_id INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=2 -INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = DECODE(@challengeId@, 0, p.project_id, @challengeId@) +INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = DECODE(@challenge_id@, 0, p.project_id, @challenge_id@) INNER JOIN project_phase pp13 ON pp13.project_id=p.project_id AND pp13.phase_type_id=13 AND not exists (SELECT 1 FROM phase_dependency WHERE dependent_phase_id=pp13.project_phase_id) INNER JOIN phase_dependency pd ON pd.dependency_phase_id=pp13.project_phase_id INNER JOIN project_phase pp14 ON pp14.project_id=p.project_id AND pp14.phase_type_id=14 AND pp14.project_phase_id=pd.dependent_phase_id @@ -27,7 +27,7 @@ DISTINCT FROM project_payment_adjustment ppa INNER JOIN review_auction ra ON ra.project_id = ppa.project_id INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=1 -INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = DECODE(@challengeId@, 0, p.project_id, @challengeId@) +INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = DECODE(@challenge_id@, 0, p.project_id, @challenge_id@) INNER JOIN project_phase pp2 ON pp2.project_id=p.project_id AND pp2.phase_type_id=2 INNER JOIN project_phase pp4 ON pp4.project_id=p.project_id AND pp4.phase_type_id=4 INNER JOIN phase_criteria pc ON pc.project_phase_id=pp4.project_phase_id AND pc.phase_criteria_type_id=6 @@ -46,7 +46,7 @@ DISTINCT FROM project_payment_adjustment ppa INNER JOIN review_auction ra ON ra.project_id = ppa.project_id INNER JOIN review_auction_type_lu ratl ON ratl.review_auction_type_id=ra.review_auction_type_id AND ratl.review_auction_category_id=3 -INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = DECODE(@challengeId@, 0, p.project_id, @challengeId@) +INNER JOIN project p ON p.project_id=ra.project_id AND p.project_id = DECODE(@challenge_id@, 0, p.project_id, @challenge_id@) INNER JOIN project_phase pp2 ON pp2.project_id=p.project_id AND pp2.phase_type_id=2 INNER JOIN project_phase pp18 ON pp18.project_id=p.project_id AND pp18.phase_type_id=18 INNER JOIN phase_dependency pd ON pd.dependent_phase_id=pp18.project_phase_id AND pd.dependent_start=1 AND pd.dependency_phase_id=pp2.project_phase_id AND pd.dependency_start=1 diff --git a/queries/search_software_studio_challenges b/queries/search_software_studio_challenges index 8ce1c915d..a30f079cb 100644 --- a/queries/search_software_studio_challenges +++ b/queries/search_software_studio_challenges @@ -113,18 +113,9 @@ LEFT OUTER JOIN ( WHERE pp4.phase_type_id = 4 AND pc4.phase_criteria_type_id = 1 ) review ON review.project_id = p.project_id -LEFT OUTER JOIN ( - SELECT - scheduled_end_time - , actual_end_time - , phase_type_id - , pp.project_id - FROM project p - LEFT OUTER JOIN project_phase pp ON pp.project_id = p.project_id - WHERE project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase pp WHERE pp.project_id = p.project_id AND pp.phase_status_id = 2 AND pp.phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) -) nd_phase ON nd_phase.project_id = p.project_id INNER JOIN project_phase pp1 ON pp1.project_id = p.project_id AND pp1.phase_type_id = 1 INNER JOIN project_status_lu pstatus ON p.project_status_id = pstatus.project_status_id +LEFT OUTER JOIN project_phase nd_phase ON p.project_Id = nd_phase.project_id , project_category_lu pcl WHERE 1=1 AND p.project_category_id = pcl.project_category_id @@ -137,12 +128,14 @@ AND pcl.project_category_id NOT IN (27, 37) --exclude when spec review was a 'co AND p.project_status_id IN (@project_status_id@) AND pcl.project_type_id IN (@project_type_id@) AND pp1.phase_status_id IN (@registration_phase_status@) -AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') +AND nd_phase.project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase WHERE project_id = p.project_id AND phase_status_id = 2 AND phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) +AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') AND LOWER(pcl.description) = DECODE('@categoryName@', '', LOWER(pcl.description), '@categoryName@') AND LOWER(pi.challenge_name) LIKE ('@challengeName@') AND NVL(pr.prize1, 0) >= @prilower@ AND NVL(pr.prize1, 0) <= @priupper@ AND p.tc_direct_project_id = DECODE(@tcdirectid@, 0, p.tc_direct_project_id, @tcdirectid@) AND NVL(LOWER(pi.cmc_task_id), '') = DECODE('@cmc@', '', NVL(LOWER(pi.cmc_task_id), ''), '@cmc@') + ORDER BY @sortColumn@ @sortOrder@ diff --git a/queries/search_software_studio_challenges_count b/queries/search_software_studio_challenges_count index 8de597dd7..6ca4a449e 100644 --- a/queries/search_software_studio_challenges_count +++ b/queries/search_software_studio_challenges_count @@ -1,5 +1,5 @@ SELECT - COUNT(*) AS total + COUNT(DISTINCT p.project_id) AS total FROM project p LEFT JOIN ( SELECT @@ -67,18 +67,9 @@ LEFT OUTER JOIN ( WHERE pp4.phase_type_id = 4 AND pc4.phase_criteria_type_id = 1 ) review ON review.project_id = p.project_id -LEFT OUTER JOIN ( - SELECT - scheduled_end_time - , actual_end_time - , phase_type_id - , pp.project_id - FROM project p - LEFT OUTER JOIN project_phase pp ON pp.project_id = p.project_id - WHERE project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase pp WHERE pp.project_id = p.project_id AND pp.phase_status_id = 2 AND pp.phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) -) nd_phase ON nd_phase.project_id = p.project_id INNER JOIN project_phase pp1 ON pp1.project_id = p.project_id AND pp1.phase_type_id = 1 INNER JOIN project_status_lu pstatus ON p.project_status_id = pstatus.project_status_id +LEFT OUTER JOIN project_phase nd_phase ON p.project_Id = nd_phase.project_id , project_category_lu pcl WHERE 1=1 AND p.project_category_id = pcl.project_category_id @@ -91,11 +82,14 @@ AND pcl.project_category_id NOT IN (27, 37) --exclude when spec review was a 'co AND p.project_status_id IN (@project_status_id@) AND pcl.project_type_id IN (@project_type_id@) AND pp1.phase_status_id IN (@registration_phase_status@) -AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') +AND nd_phase.project_phase_id = (SELECT MAX(project_phase_id) FROM project_phase WHERE project_id = p.project_id AND phase_status_id = 2 AND phase_type_id IN (1,2,3,4,5,6,7,8,9,10,11,12)) +AND NVL(pp.submission_actual_end_time, pp.submission_scheduled_end_time) BETWEEN TO_DATE('@submissionEndFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submissionEndTo@ 23:59:59', '%Y-%m-%d %H:%M:%S') AND LOWER(pcl.description) = DECODE('@categoryName@', '', LOWER(pcl.description), '@categoryName@') AND LOWER(pi.challenge_name) LIKE ('@challengeName@') AND NVL(pr.prize1, 0) >= @prilower@ AND NVL(pr.prize1, 0) <= @priupper@ AND p.tc_direct_project_id = DECODE(@tcdirectid@, 0, p.tc_direct_project_id, @tcdirectid@) AND NVL(LOWER(pi.cmc_task_id), '') = DECODE('@cmc@', '', NVL(LOWER(pi.cmc_task_id), ''), '@cmc@') + +ORDER BY @sortColumn@ @sortOrder@ diff --git a/queries/update_review_application b/queries/update_review_application new file mode 100644 index 000000000..ee1c6bbd6 --- /dev/null +++ b/queries/update_review_application @@ -0,0 +1 @@ +UPDATE review_application SET review_application_status_id = @status@, modify_date = current WHERE review_application_id = @review_application_id@ diff --git a/queries/update_review_application.json b/queries/update_review_application.json new file mode 100644 index 000000000..f541718df --- /dev/null +++ b/queries/update_review_application.json @@ -0,0 +1,5 @@ +{ + "name" : "update_review_application", + "db" : "tcs_catalog", + "sqlfile" : "update_review_application" +} diff --git a/routes.js b/routes.js index adaeac535..939e8a396 100755 --- a/routes.js +++ b/routes.js @@ -1,8 +1,8 @@ /* * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. * - * @version 1.29 - * @author vangavroche, Sky_, muzehyun, kurtrips, Ghost_141, ecnu_haozi, hesibo, LazyChild + * @version 1.32 + * @author vangavroche, Sky_, muzehyun, kurtrips, Ghost_141, ecnu_haozi, hesibo, LazyChild, bugbuka * Changes in 1.1: * - add routes for search challenges * Changes in 1.2: @@ -61,6 +61,7 @@ * - added stub api for reset token and reset password * changes in 1.25 * - add route for register marathon match challenge api. + * - added api for docusign callback * changes in 1.26: * - added route for handling design submission * changes in 1.27 @@ -69,10 +70,18 @@ * - added route for Dosusign get recipient view url * changes in 1.29 * - added route for activate user api + * changes in 1.30 + * - added route for getting marathon match challenge register info api + * Changes in 1.31: + * - add route for challenge rss output api. + * changes in 1.32: + * - added route for Challenge Unregistration API + * Changes in 1.33: + * - add route for apply develop review opportunities api. */ /* --------------------- -routes.js +routes.js For web clients (http and https) you can define an optional RESTful mapping to help route requests to actions. If the client doesn't specify and action in a param, and the base route isn't a named action, @@ -80,7 +89,7 @@ the action will attempt to be discerned from this routes.js file. - routes remain optional - actions defiend in params directly `action=theAction` or hitting the named URL for an action `/api/theAction` - will always override RESTful routing + will always override RESTful routing - you can mix explicitly defined params with route-defined params. If there is an overlap, the route-defined params win - IE: /api/user/123?userId=456 => `connection.userId = 123` - this is a change from previous versions @@ -136,6 +145,8 @@ var testMethods = { exports.routes = { get: [ { path: "/:apiVersion/logs", action: "getLogTail" }, + { path: "/:apiVersion/challenges/rss", action: "getChallengesRSS" }, + { path: "/:apiVersion/challenges/:challengeId", action: "getChallenge" }, { path: "/:apiVersion/challenges", action: "searchSoftwareAndStudioChallenges" }, { path: "/:apiVersion/develop/challenges/checkpoint/:challengeId", action: "getSoftwareCheckpoint" }, @@ -143,7 +154,7 @@ exports.routes = { { path: "/:apiVersion/develop/challengetypes", action: "softwareTypes" }, { path: "/:apiVersion/develop/challenges/result/:challengeId", action: "getSoftwareChallengeResults" }, - { path: "/:apiVersion/develop/challenges/:contestId", action: "getSoftwareChallenge" }, + { path: "/:apiVersion/develop/challenges/:challengeId", action: "getSoftwareChallenge" }, { path: "/:apiVersion/develop/statistics/tops/:contestType", action: "getTops" }, { path: "/:apiVersion/develop/statistics/:handle/:challengeType", action: "getSoftwareRatingHistoryAndDistribution" }, { path: "/:apiVersion/develop/challenges", action: "searchSoftwareChallenges" }, @@ -154,7 +165,7 @@ exports.routes = { { path: "/:apiVersion/design/challengetypes", action: "studioTypes" }, { path: "/:apiVersion/design/challenges/result/:challengeId", action: "getStudioChallengeResults" }, { path: "/:apiVersion/design/reviewOpportunities/:id", action: "getStudioReviewOpportunity" }, - { path: "/:apiVersion/design/challenges/:contestId", action: "getStudioChallenge" }, + { path: "/:apiVersion/design/challenges/:challengeId", action: "getStudioChallenge" }, { path: "/:apiVersion/design/challenges", action: "searchStudioChallenges" }, { path: "/:apiVersion/design/reviewOpportunities", action: "getStudioReviewOpportunities" }, { path: "/:apiVersion/design/download/:submissionId", action: "downloadDesignSubmission" }, @@ -179,6 +190,7 @@ exports.routes = { { path: "/:apiVersion/data/srm/challenges/:id", action: "getSRMChallenge" }, { path: "/:apiVersion/data/srm/challenges", action: "searchSRMChallenges" }, + { path: "/:apiVersion/data/marathon/challenges/:roundId/regInfo", action: "getMarathonChallengeRegInfo" }, { path: "/:apiVersion/data/marathon/challenges/:id", action: "getMarathonChallenge" }, { path: "/:apiVersion/data/marathon/challenges", action: "searchMarathonChallenges" }, { path: "/:apiVersion/data/marathon/statistics/tops", action: "getMarathonTops" }, @@ -218,11 +230,14 @@ exports.routes = { // Stub API { path: "/:apiVersion/users/resetPassword/:handle", action: "resetPassword" }, + { path: "/:apiVersion/develop/reviewOpportunities/:challengeId/apply", action: "applyDevelopReviewOpportunity" }, + { path: "/:apiVersion/terms/docusignCallback", action: "docusignCallback" }, { path: "/:apiVersion/terms/:termsOfUseId/agree", action: "agreeTermsOfUse" }, { path: "/:apiVersion/users", action: "memberRegister" }, { path: "/:apiVersion/develop/challenges/:challengeId/submit", action: "submitForDevelopChallenge" }, { path: "/:apiVersion/design/challenges/:challengeId/submit", action: "submitForDesignChallenge" }, { path: "/:apiVersion/challenges/:challengeId/register", action: "registerChallenge" }, + { path: "/:apiVersion/challenges/:challengeId/unregister", action: "unregisterChallenge" }, { path: "/:apiVersion/auth", action: "generateJwt" }, { path: "/:apiVersion/reauth", action: "refreshJwt" }, { path: "/:apiVersion/platform/billing", action: "createBilling" }, diff --git a/tasks/sendEmail.js b/tasks/sendEmail.js index fe6bae047..a26a2fee4 100644 --- a/tasks/sendEmail.js +++ b/tasks/sendEmail.js @@ -2,9 +2,11 @@ * Copyright (C) 2013 TopCoder Inc., All Rights Reserved. * * Version: 1.1 - * Author: TCSASSEMBLER, ecnu_haozi + * Author: TCSASSEMBLER, ecnu_haozi, TCSASSEMBLER * changes in 1.1 * - Remove the required fields check to make this email-sending logic more general and flexible. + * changes in 1.2 + * - The From address can now be passed in params and if not present falls back to the configureation value */ "use strict"; @@ -80,7 +82,7 @@ var sendEmail = { // build email message message = { - from: tc_email_from, + from: params.fromAddress || tc_email_from, to: params.toAddress, subject: params.subject, html: html, diff --git a/test/sqls/applyDevelopReviewOpportunity/common_oltp__clean b/test/sqls/applyDevelopReviewOpportunity/common_oltp__clean new file mode 100644 index 000000000..503a77539 --- /dev/null +++ b/test/sqls/applyDevelopReviewOpportunity/common_oltp__clean @@ -0,0 +1,2 @@ +DELETE FROM user_terms_of_use_xref WHERE user_id = 132457; +DELETE FROM project_role_terms_of_use_xref WHERE project_id = 2001; diff --git a/test/sqls/applyDevelopReviewOpportunity/common_oltp__insert_test_data b/test/sqls/applyDevelopReviewOpportunity/common_oltp__insert_test_data new file mode 100644 index 000000000..2861cd1cf --- /dev/null +++ b/test/sqls/applyDevelopReviewOpportunity/common_oltp__insert_test_data @@ -0,0 +1,5 @@ +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, create_date, modify_date, sort_order, group_ind) +VALUES(2001, 4, 20704, current, current, 0, 1); + +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id, create_date, modify_date) +VALUES(132457, 20704, current, current); diff --git a/test/sqls/applyDevelopReviewOpportunity/tcs_catalog__clean b/test/sqls/applyDevelopReviewOpportunity/tcs_catalog__clean new file mode 100644 index 000000000..6d9d635ab --- /dev/null +++ b/test/sqls/applyDevelopReviewOpportunity/tcs_catalog__clean @@ -0,0 +1,9 @@ +DELETE FROM resource_info WHERE resource_id >= 2001; +DELETE FROM resource WHERE project_id >= 2001; +DELETE FROM group_contest_eligibility WHERE contest_eligibility_id = 2001; +DELETE FROM contest_eligibility WHERE contest_id >= 2001; +DELETE FROM phase_criteria WHERE project_phase_id >= 2001; +DELETE FROM project_phase WHERE project_id >= 2001; +DELETE FROM review_application WHERE review_auction_id >= 2001; +DELETE FROM review_auction WHERE project_id >= 2001; +DELETE FROM project WHERE project_id >= 2001; diff --git a/test/sqls/applyDevelopReviewOpportunity/tcs_catalog__insert_test_data b/test/sqls/applyDevelopReviewOpportunity/tcs_catalog__insert_test_data new file mode 100644 index 000000000..77887ea0e --- /dev/null +++ b/test/sqls/applyDevelopReviewOpportunity/tcs_catalog__insert_test_data @@ -0,0 +1,187 @@ +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2001, 1, 14, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2001, 2001, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2001, 2001, 1, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2002, 2001, 2, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2003, 2001, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2004, 2001, 4, 1, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2004, 6, 3, 132456, current, 132456, current); + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2002, 1, 14, 132456, current, 132456, current); + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2003, 1, 14, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2003, 2003, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2005, 2003, 1, 3, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2006, 2003, 2, 3, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2007, 2003, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2008, 2003, 4, 3, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2008, 6, 3, 132456, current, 132456, current); + + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2004, 1, 13, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2004, 2004, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2009, 2004, 1, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2010, 2004, 2, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2011, 2004, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2012, 2004, 4, 2, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2012, 6, 3, 132456, current, 132456, current); + + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2005, 1, 14, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2005, 2005, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2013, 2005, 1, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2014, 2005, 2, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2015, 2005, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2016, 2005, 4, 1, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2016, 6, 3, 132456, current, 132456, current); + +INSERT INTO contest_eligibility(contest_eligibility_id, contest_id, is_studio) VALUES(2001, 2005, 0); +INSERT INTO group_contest_eligibility(contest_eligibility_id, group_id) VALUES(2001, 208); + + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2006, 1, 14, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2006, 2006, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2017, 2006, 1, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2018, 2006, 2, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2019, 2006, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2020, 2006, 4, 1, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2020, 6, 3, 132456, current, 132456, current); + +INSERT INTO resource(resource_id, resource_role_id, project_id, project_phase_id, user_id, create_user, create_date, modify_user, modify_date) +VALUES(2001, 4, 2006, 2020, 132456, 132456, current, 132456, current); +INSERT INTO resource(resource_id, resource_role_id, project_id, project_phase_id, user_id, create_user, create_date, modify_user, modify_date) +VALUES(2002, 4, 2006, 2020, 132458, 132456, current, 132456, current); +INSERT INTO resource(resource_id, resource_role_id, project_id, project_phase_id, user_id, create_user, create_date, modify_user, modify_date) +VALUES(2003, 4, 2006, 2020, 124764, 132456, current, 132456, current); + + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2007, 1, 14, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2007, 2007, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2021, 2007, 1, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2022, 2007, 2, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2023, 2007, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2024, 2007, 4, 1, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2024, 6, 3, 132456, current, 132456, current); + +INSERT INTO review_application(review_application_id, user_id, review_auction_id, review_application_role_id, review_application_status_id, create_date, modify_date) +VALUES(2002, 132456, 2007, 1, 3, current, current); + +INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) +VALUES(2004, 2, 2007, 132456, current, 132456, current); +INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) +VALUES(2004, 1, '132456', 132456, current, 132456, current); +INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) +VALUES(2005, 4, 2007, 132456, current, 132456, current); +INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) +VALUES(2005, 1, '132456', 132456, current, 132456, current); +INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) +VALUES(2006, 8, 2007, 132456, current, 132456, current); +INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) +VALUES(2006, 1, '132456', 132456, current, 132456, current); +INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) +VALUES(2007, 9, 2007, 132456, current, 132456, current); +INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) +VALUES(2007, 1, '132456', 132456, current, 132456, current); + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2008, 1, 14, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2008, 2008, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2025, 2008, 1, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2026, 2008, 2, 2, current, current + 3 units month, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2027, 2008, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2028, 2008, 4, 1, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2028, 6, 3, 132456, current, 132456, current); + + +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date) +VALUES(2009, 1, 14, 132456, current, 132456, current); + +INSERT INTO review_auction(review_auction_id, project_id, review_auction_type_id) VALUES(2009, 2009, 1); + +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2029, 2009, 1, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2030, 2009, 2, 2, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2031, 2009, 3, 1, current, current, 86400000, 132456, current, 132456, current); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) +VALUES(2032, 2009, 4, 1, current, current, 86400000, 132456, current, 132456, current); + +INSERT INTO phase_criteria(project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) +VALUES(2032, 6, 3, 132456, current, 132456, current); + +INSERT INTO review_application(review_application_id, user_id, review_auction_id, review_application_role_id, review_application_status_id, create_date, modify_date) +VALUES(2003, 124766, 2009, 2, 3, current, current); +INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) +VALUES(2008, 4, 2009, 132456, current, 132456, current); +INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) +VALUES(2008, 1, '124766', 132456, current, 132456, current); + +INSERT INTO review_application(review_application_id, user_id, review_auction_id, review_application_role_id, review_application_status_id, create_date, modify_date) +VALUES(2004, 124764, 2009, 2, 3, current, current); +INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) +VALUES(2009, 4, 2009, 132456, current, 132456, current); +INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) +VALUES(2009, 1, '124764', 132456, current, 132456, current); diff --git a/test/sqls/challengeUnregistration/common_oltp__clean b/test/sqls/challengeUnregistration/common_oltp__clean new file mode 100755 index 000000000..1e0ed8835 --- /dev/null +++ b/test/sqls/challengeUnregistration/common_oltp__clean @@ -0,0 +1,11 @@ +delete from user_social_login where user_id > 400010 and user_id < 400020; +delete from user_address_xref where address_id > 40000000 and address_id < 40000010; +delete from address where address_id > 40000000 and address_id < 40000010; +delete from project_role_terms_of_use_xref where project_id > 40000000 and project_id < 40000020; +delete from user_terms_of_use_xref where user_id > 400010 and user_id < 400020; +delete from user_status where user_id > 400010 and user_id < 400020; +delete from security_user where login_id > 400010 and login_id < 400020; +delete from email where email_id > 400010 and email_id < 400020; +delete from corona_event where user_id > 400010 and user_id < 400020; +delete from user where user_id > 400010 and user_id < 400020; + diff --git a/test/sqls/challengeUnregistration/common_oltp__clean.json b/test/sqls/challengeUnregistration/common_oltp__clean.json new file mode 100755 index 000000000..b9356c845 --- /dev/null +++ b/test/sqls/challengeUnregistration/common_oltp__clean.json @@ -0,0 +1,5 @@ +{ + "name" : "common_oltp__clean", + "db" : "common_oltp", + "sqlfile" : "common_oltp__clean" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/common_oltp__clean.sql b/test/sqls/challengeUnregistration/common_oltp__clean.sql new file mode 100755 index 000000000..1e0ed8835 --- /dev/null +++ b/test/sqls/challengeUnregistration/common_oltp__clean.sql @@ -0,0 +1,11 @@ +delete from user_social_login where user_id > 400010 and user_id < 400020; +delete from user_address_xref where address_id > 40000000 and address_id < 40000010; +delete from address where address_id > 40000000 and address_id < 40000010; +delete from project_role_terms_of_use_xref where project_id > 40000000 and project_id < 40000020; +delete from user_terms_of_use_xref where user_id > 400010 and user_id < 400020; +delete from user_status where user_id > 400010 and user_id < 400020; +delete from security_user where login_id > 400010 and login_id < 400020; +delete from email where email_id > 400010 and email_id < 400020; +delete from corona_event where user_id > 400010 and user_id < 400020; +delete from user where user_id > 400010 and user_id < 400020; + diff --git a/test/sqls/challengeUnregistration/common_oltp__create_sequence.sql b/test/sqls/challengeUnregistration/common_oltp__create_sequence.sql new file mode 100755 index 000000000..dfaff8892 --- /dev/null +++ b/test/sqls/challengeUnregistration/common_oltp__create_sequence.sql @@ -0,0 +1,3 @@ +CREATE SEQUENCE SEQUENCE_COMPONNENT_INQUIRY_SEQ INCREMENT BY 1 START WITH 4000000; + +CREATE SEQUENCE SEQUENCE_RESOURCE_ID_SEQ INCREMENT BY 1 START WITH 4000000; diff --git a/test/sqls/challengeUnregistration/common_oltp__insert_test_data b/test/sqls/challengeUnregistration/common_oltp__insert_test_data new file mode 100755 index 000000000..c74b9cd22 --- /dev/null +++ b/test/sqls/challengeUnregistration/common_oltp__insert_test_data @@ -0,0 +1,59 @@ +INSERT into user (user_id, handle, status, timezone_id) values (400011, 'normal_user_11', 'A', 143); +INSERT into user (user_id, handle, status, timezone_id) values (400012, 'normal_user_12', 'A', 143); +INSERT into user (user_id, handle, status, timezone_id) values (400013, 'normal_user_13', 'A', 143); + +INSERT INTO email(user_id,email_id,email_type_id,address,create_date,modify_date,primary_ind,status_id) VALUES (400011, 400011, 1, 'facebook.topcoder@gmail.com', CURRENT, CURRENT, 1, 1); + +INSERT INTO user_social_login(social_user_id, user_id, social_login_provider_id, social_user_name) VALUES ('fb400011', 400011, 1, 'user11'); +INSERT INTO user_social_login(social_user_id, user_id, social_login_provider_id, social_user_name) VALUES ('fb400012', 400012, 1, 'user12'); +INSERT INTO user_social_login(social_user_id, user_id, social_login_provider_id, social_user_name) VALUES ('fb400013', 400013, 1, 'user13'); + +INSERT INTO 'informix'.address(address_id,address_type_id,address1,address2,city,state_code,zip,country_code,create_date,modify_date,address3,province) +VALUES (40000001, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO 'informix'.address(address_id,address_type_id,address1,address2,city,state_code,zip,country_code,create_date,modify_date,address3,province) +VALUES (40000002, 2, 'address1', NULL, 'city', 'ME', '04043', '192', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); + +INSERT INTO 'informix'.user_address_xref(user_id,address_id) VALUES (400012, 40000001); +INSERT INTO 'informix'.user_address_xref(user_id,address_id) VALUES (400013, 40000002); + +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 1, 20543, 1, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 1, 20493, 2, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 4, 20623, 3, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 4, 20713, 4, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 15, 20963, 5, 1); + +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 1, 20543, 1, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 1, 20493, 2, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 4, 20623, 3, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 4, 20713, 4, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 15, 20963, 5, 1); + +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20543); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20493); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20623); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20713); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20963); + +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400012, 20543); + +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400013, 20543); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400013, 20493); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400013, 20623); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400013, 20713); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400013, 20963); + +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20543.txt' WHERE terms_of_use_id = 20543; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20493.txt' WHERE terms_of_use_id = 20493; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20623.txt' WHERE terms_of_use_id = 20623; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20713.txt' WHERE terms_of_use_id = 20713; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20963.txt' WHERE terms_of_use_id = 20963; diff --git a/test/sqls/challengeUnregistration/common_oltp__insert_test_data.json b/test/sqls/challengeUnregistration/common_oltp__insert_test_data.json new file mode 100755 index 000000000..77f0e4d97 --- /dev/null +++ b/test/sqls/challengeUnregistration/common_oltp__insert_test_data.json @@ -0,0 +1,5 @@ +{ + "name" : "common_oltp__insert_test_data", + "db" : "common_oltp", + "sqlfile" : "common_oltp__insert_test_data" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/common_oltp__insert_test_data.sql b/test/sqls/challengeUnregistration/common_oltp__insert_test_data.sql new file mode 100755 index 000000000..c81c695d6 --- /dev/null +++ b/test/sqls/challengeUnregistration/common_oltp__insert_test_data.sql @@ -0,0 +1,49 @@ +INSERT into user (user_id, handle, status, timezone_id) values (400011, 'normal_user_11', 'A', 143); +INSERT into user (user_id, handle, status, timezone_id) values (400012, 'normal_user_12', 'A', 143); + +INSERT INTO email(user_id,email_id,email_type_id,address,create_date,modify_date,primary_ind,status_id) VALUES (400011, 400011, 1, 'facebook.topcoder@gmail.com', CURRENT, CURRENT, 1, 1); + +INSERT INTO user_social_login(social_user_id, user_id, social_login_provider_id, social_user_name) VALUES ('fb400011', 400011, 1, 'user11'); +INSERT INTO user_social_login(social_user_id, user_id, social_login_provider_id, social_user_name) VALUES ('fb400012', 400012, 1, 'user12'); + +INSERT INTO 'informix'.address(address_id,address_type_id,address1,address2,city,state_code,zip,country_code,create_date,modify_date,address3,province) +VALUES (40000001, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); + +INSERT INTO 'informix'.user_address_xref(user_id,address_id) VALUES (400011, 40000001); +INSERT INTO 'informix'.user_address_xref(user_id,address_id) VALUES (400012, 40000001); + +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 1, 20543, 1, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 1, 20493, 2, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 4, 20623, 3, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 4, 20713, 4, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000001, 15, 20963, 5, 1); + +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 1, 20543, 1, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 1, 20493, 2, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 4, 20623, 3, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 4, 20713, 4, 1); +INSERT INTO project_role_terms_of_use_xref(project_id, resource_role_id, terms_of_use_id, sort_order, group_ind) +VALUES (40000002, 15, 20963, 5, 1); + +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20543); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20493); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20623); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20713); +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400011, 20963); + +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id) VALUES (400012, 20543); + +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20543.txt' WHERE terms_of_use_id = 20543; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20493.txt' WHERE terms_of_use_id = 20493; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20623.txt' WHERE terms_of_use_id = 20623; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20713.txt' WHERE terms_of_use_id = 20713; +UPDATE terms_of_use SET url = 'http://topcoder.com/terms/20963.txt' WHERE terms_of_use_id = 20963; diff --git a/test/sqls/challengeUnregistration/informixoltp__clean b/test/sqls/challengeUnregistration/informixoltp__clean new file mode 100755 index 000000000..0fbeadc36 --- /dev/null +++ b/test/sqls/challengeUnregistration/informixoltp__clean @@ -0,0 +1 @@ +DELETE FROM coder WHERE coder_id = 400013; diff --git a/test/sqls/challengeUnregistration/informixoltp__insert_test_data b/test/sqls/challengeUnregistration/informixoltp__insert_test_data new file mode 100755 index 000000000..21adb5061 --- /dev/null +++ b/test/sqls/challengeUnregistration/informixoltp__insert_test_data @@ -0,0 +1,2 @@ +INSERT INTO 'informixoltp':coder(coder_id, quote, coder_type_id, comp_country_code, display_quote, quote_location, quote_color, display_banner, banner_style) +VALUES(400013, '', 2, '192', 1, 'md', '#000000', 1, 'bannerStyle1'); \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/jive__clean b/test/sqls/challengeUnregistration/jive__clean new file mode 100755 index 000000000..4824e26ac --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__clean @@ -0,0 +1,4 @@ +delete from jiveuserperm where userid = 400011; +delete from jivegroupuser where userid > 400010 and userid < 400020; +delete from jivegroup where groupid >= 101 and groupid <= 104; +delete from jivecategory where categoryid >= 1001 and categoryid <= 1004; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/jive__clean.json b/test/sqls/challengeUnregistration/jive__clean.json new file mode 100755 index 000000000..a70d93c50 --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__clean.json @@ -0,0 +1,5 @@ +{ + "name" : "jive__clean", + "db" : "jive", + "sqlfile" : "jive__clean" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/jive__clean.sql b/test/sqls/challengeUnregistration/jive__clean.sql new file mode 100755 index 000000000..4824e26ac --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__clean.sql @@ -0,0 +1,4 @@ +delete from jiveuserperm where userid = 400011; +delete from jivegroupuser where userid > 400010 and userid < 400020; +delete from jivegroup where groupid >= 101 and groupid <= 104; +delete from jivecategory where categoryid >= 1001 and categoryid <= 1004; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/jive__insert_test_data b/test/sqls/challengeUnregistration/jive__insert_test_data new file mode 100755 index 000000000..0f110cbd7 --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__insert_test_data @@ -0,0 +1,15 @@ +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (101, 'Software_Users_1001', 'contest for autotest 1', 1395226951776, 1395226951776); +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (102, 'Software_Moderators_1001', 'contest for autotest 1', 1395226951776, 1395226951776); +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (103, 'Software_Users_1002', 'contest for autotest 2', 1395226951776, 1395226951776); +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (104, 'Software_Moderators_1002', 'contest for autotest 2', 1395226951776, 1395226951776); + +INSERT INTO jivegroupuser (groupid, userid, administrator) VALUES (1001,400011, 0); + +INSERT INTO jivecategory (categoryid, name, description, creationdate, modificationdate, lft, rgt) VALUES (1001, 'test_1001', 'test_1001', 1396014756004, 1396014756004, 1001, 1003); + +INSERT INTO jiveuserperm (objecttype, objectid, userid, permissiontype, permission) VALUES (14, 1001, 400011, 1, 0); +INSERT INTO jiveuserperm (objecttype, objectid, userid, permissiontype, permission) VALUES (14, 1001, 400011, 1, 2); +INSERT INTO jiveuserperm (objecttype, objectid, userid, permissiontype, permission) VALUES (14, 1001, 400011, 1, 1); +INSERT INTO jiveuserperm (objecttype, objectid, userid, permissiontype, permission) VALUES (14, 1001, 400011, 1, 6); +INSERT INTO jiveuserperm (objecttype, objectid, userid, permissiontype, permission) VALUES (14, 1001, 400011, 1, 4); +INSERT INTO jiveuserperm (objecttype, objectid, userid, permissiontype, permission) VALUES (14, 1001, 400011, 1, 10); diff --git a/test/sqls/challengeUnregistration/jive__insert_test_data.json b/test/sqls/challengeUnregistration/jive__insert_test_data.json new file mode 100755 index 000000000..ed8c2f9ba --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__insert_test_data.json @@ -0,0 +1,5 @@ +{ + "name" : "jive__insert_test_data", + "db" : "jive", + "sqlfile" : "jive__insert_test_data" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/jive__insert_test_data.sql b/test/sqls/challengeUnregistration/jive__insert_test_data.sql new file mode 100755 index 000000000..89049c2d7 --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__insert_test_data.sql @@ -0,0 +1,4 @@ +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (101, 'Software_Users_1001', 'contest for autotest 1', 1395226951776, 1395226951776); +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (102, 'Software_Moderators_1001', 'contest for autotest 1', 1395226951776, 1395226951776); +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (103, 'Software_Users_1002', 'contest for autotest 2', 1395226951776, 1395226951776); +INSERT INTO jivegroup(groupid, name, description, creationdate, modificationdate) VALUES (104, 'Software_Moderators_1002', 'contest for autotest 2', 1395226951776, 1395226951776); diff --git a/test/sqls/challengeUnregistration/jive__select_jiveuserperm b/test/sqls/challengeUnregistration/jive__select_jiveuserperm new file mode 100755 index 000000000..68027c47f --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__select_jiveuserperm @@ -0,0 +1 @@ +* from jiveuserperm where userid = 400011; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/jive__select_jiveuserperm.json b/test/sqls/challengeUnregistration/jive__select_jiveuserperm.json new file mode 100755 index 000000000..d03eccdf0 --- /dev/null +++ b/test/sqls/challengeUnregistration/jive__select_jiveuserperm.json @@ -0,0 +1,5 @@ +{ + "name" : "jive__select_jiveuserperm", + "db" : "jive", + "sqlfile" : "jive__select_jiveuserperm" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__clean b/test/sqls/challengeUnregistration/tcs_catalog__clean new file mode 100755 index 000000000..ea45daf34 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__clean @@ -0,0 +1,21 @@ +delete from resource_info where resource_id in (select resource_id from resource where project_id > 40000000 and project_id < 40000020); +delete from component_inquiry where component_inquiry_id > 80000001 and component_inquiry_id < 80000020; +delete from project_result where user_id = 400011; +delete from resource where project_id > 40000000 and project_id < 40000020; +delete from project_result where project_id > 40000000 and project_id < 40000020; +delete from project_user_audit where project_id > 40000000 and project_id < 40000020; +delete from component_inquiry where project_id > 40000000 and project_id < 40000020; + +delete from project_info where project_id > 40000000 and project_id < 40000020; +delete from project_phase where project_id > 40000000 and project_id < 40000020; +delete from component_inquiry where project_id > 40000000 and project_id < 40000020; +delete from project where project_id > 40000000 and project_id < 40000020; +delete from comp_version_dates_history where comp_vers_id > 40000000 and comp_vers_id < 40000020; +delete from comp_jive_category_xref where jive_category_id >= 1001 and jive_category_id <= 1003; +delete from comp_versions where component_id > 40000000 and component_id < 40000020; +delete from comp_versions where comp_vers_id > 40000000 and comp_vers_id < 40000020; +delete from comp_catalog where component_id > 40000000 and component_id < 40000020; +delete from user_rating where user_id = 400011; +delete from user_reliability where user_id = 400011; +delete from project_studio_specification where project_studio_spec_id = 1001; +delete from copilot_profile where copilot_profile_id = 400011; diff --git a/test/sqls/challengeUnregistration/tcs_catalog__clean.json b/test/sqls/challengeUnregistration/tcs_catalog__clean.json new file mode 100755 index 000000000..fc515d318 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__clean.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__clean", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__clean" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__clean.sql b/test/sqls/challengeUnregistration/tcs_catalog__clean.sql new file mode 100755 index 000000000..ea45daf34 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__clean.sql @@ -0,0 +1,21 @@ +delete from resource_info where resource_id in (select resource_id from resource where project_id > 40000000 and project_id < 40000020); +delete from component_inquiry where component_inquiry_id > 80000001 and component_inquiry_id < 80000020; +delete from project_result where user_id = 400011; +delete from resource where project_id > 40000000 and project_id < 40000020; +delete from project_result where project_id > 40000000 and project_id < 40000020; +delete from project_user_audit where project_id > 40000000 and project_id < 40000020; +delete from component_inquiry where project_id > 40000000 and project_id < 40000020; + +delete from project_info where project_id > 40000000 and project_id < 40000020; +delete from project_phase where project_id > 40000000 and project_id < 40000020; +delete from component_inquiry where project_id > 40000000 and project_id < 40000020; +delete from project where project_id > 40000000 and project_id < 40000020; +delete from comp_version_dates_history where comp_vers_id > 40000000 and comp_vers_id < 40000020; +delete from comp_jive_category_xref where jive_category_id >= 1001 and jive_category_id <= 1003; +delete from comp_versions where component_id > 40000000 and component_id < 40000020; +delete from comp_versions where comp_vers_id > 40000000 and comp_vers_id < 40000020; +delete from comp_catalog where component_id > 40000000 and component_id < 40000020; +delete from user_rating where user_id = 400011; +delete from user_reliability where user_id = 400011; +delete from project_studio_specification where project_studio_spec_id = 1001; +delete from copilot_profile where copilot_profile_id = 400011; diff --git a/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data b/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data new file mode 100755 index 000000000..95c6252c2 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data @@ -0,0 +1,84 @@ +INSERT INTO project (project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id, project_studio_spec_id) VALUES (40000001, 1, 2, 132456, CURRENT, 132456, CURRENT, 40000011, null); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000001, 6, 'Java Throttle 1.0', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000001, 2, '40000001', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000001, 4, '1001', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO comp_catalog (component_id, current_version, short_desc, component_name, description, function_desc, create_time, status_id, root_category_id, modify_date, public_ind) VALUES ('40000001', '1', 'Coolest component ever', 'Component 4', 'Coolest component ever', 'Component', CURRENT, '1', '5801776', CURRENT, '0'); + +INSERT INTO comp_versions (comp_vers_id, component_id, version, version_text, create_time, phase_id, phase_time, price, comments, modify_date, suspended_ind) VALUES ('40000001', '40000001', '1', '1.0', CURRENT, '113', '1976-05-04 00:00:00.0', '1000.00', 'Cool', CURRENT, '0'); + +INSERT INTO comp_jive_category_xref (comp_vers_id, jive_category_id) VALUES ('40000001', 1001); + +INSERT INTO comp_version_dates_history (comp_version_dates_history_id, comp_vers_id, phase_id , initial_submission_date) VALUES (40000001, 40000001, 113, CURRENT); + +INSERT INTO resource (resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) VALUES (40000001, 1, 40000001, 400011, current, 400011, current); + +INSERT INTO resource_info (resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000001, 1, 400011, 400011, current, 400011, current); + +INSERT INTO tcs_catalog:component_inquiry (component_inquiry_id, component_id, user_id, comment, agreed_to_terms, rating, phase, tc_user_id, version, create_time, project_id) VALUES (80000001, 40000001, 400011, 'Cool', 1, 0, 113, 400011, 1, current, 40000001); + +INSERT INTO tcs_catalog:project_result (user_id, project_id, old_rating, new_rating, raw_score, final_score, payment, placed, rating_ind, valid_submission_ind, create_date, modify_date, passed_review_ind, point_adjustment, rating_order) VALUES (400011, 40000001, 0, 1, 80, 90, 1, 0, 0, 0, current, current, 1, 1, 1); + +INSERT INTO project_studio_specification(project_studio_spec_id,contest_description,create_user,create_date,modify_user,modify_date) VALUES (1001,'Description of Studio Contest 40000002.','132456',CURRENT,'132456',CURRENT); + +INSERT INTO project_phase (project_phase_id, project_id, phase_type_id, phase_status_id, fixed_start_time, scheduled_start_time, scheduled_end_time, actual_start_time, actual_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (40000001, 40000001, 1, 2, null, CURRENT + -44640 UNITS MINUTE, CURRENT + -36000 UNITS MINUTE, CURRENT + -44640 UNITS MINUTE, null, 518400000, 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project (project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id, project_studio_spec_id) VALUES (40000002, 1, 20, 132456, CURRENT, 132456, CURRENT, 40000012, 1001); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000002, 6, 'Hestia Business Information', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000002, 2, '40000002', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000002, 4, '1001', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO comp_catalog (component_id, current_version, short_desc, component_name, description, function_desc, create_time, status_id, root_category_id, modify_date, public_ind) VALUES ('40000002', '1', 'Coolest component ever', 'Component 4', 'Coolest component ever', 'Component', CURRENT, '1', '5801776', CURRENT, '0'); + +INSERT INTO comp_versions (comp_vers_id, component_id, version, version_text, create_time, phase_id, phase_time, price, comments, modify_date, suspended_ind) VALUES ('40000002', '40000002', '1', '1.0', CURRENT, '131', '1976-05-04 00:00:00.0', '1000.00', 'Cool', CURRENT, '0'); + +INSERT INTO comp_jive_category_xref (comp_vers_id, jive_category_id) VALUES ('40000002', 1002); + +INSERT INTO resource (resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) VALUES (40000002, 1, 40000002, 400011, current, 400011, current); + +INSERT INTO resource_info (resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000002, 1, 400011, 400011, current, 400011, current); + +INSERT INTO project_phase (project_phase_id, project_id, phase_type_id, phase_status_id, fixed_start_time, scheduled_start_time, scheduled_end_time, actual_start_time, actual_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (40000002, 40000002, 1, 2, null, CURRENT + -44640 UNITS MINUTE, CURRENT + -36000 UNITS MINUTE, CURRENT + -44640 UNITS MINUTE, null, 518400000, 132456, CURRENT, 132456, CURRENT); + +INSERT INTO user_rating (user_id, rating, phase_id, last_rated_project_id) values (400011, 0, 113, null); + +INSERT INTO user_reliability (user_id, rating, phase_id) values (400011, null, 113); + +INSERT INTO user_rating (user_id, rating, phase_id, last_rated_project_id) values (400011, 3000, 131, 40000003); + +INSERT INTO user_reliability (user_id, rating, phase_id) values (400011, 1.00, 131); + +INSERT INTO project (project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id, project_studio_spec_id) VALUES (40000003, 1, 29, 132456, CURRENT, 132456, CURRENT, 40000011, null); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000003, 6, 'Java Throttle 1.0', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000003, 2, '40000003', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000003, 4, '1001', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO comp_catalog (component_id, current_version, short_desc, component_name, description, function_desc, create_time, status_id, root_category_id, modify_date, public_ind) VALUES ('40000003', '1', 'Coolest component ever', 'Component 4', 'Coolest component ever', 'Component', CURRENT, '1', '5801776', CURRENT, '0'); + +INSERT INTO comp_versions (comp_vers_id, component_id, version, version_text, create_time, phase_id, phase_time, price, comments, modify_date, suspended_ind) VALUES ('40000003', '40000003', '1', '1.0', CURRENT, '113', '1976-05-04 00:00:00.0', '1000.00', 'Cool', CURRENT, '0'); + +INSERT INTO resource (resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) VALUES (40000003, 1, 40000003, 400011, current, 400011, current); + +INSERT INTO resource_info (resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000003, 1, 400011, 400011, current, 400011, current); + +INSERT INTO component_inquiry (component_inquiry_id, component_id, user_id, comment, agreed_to_terms, rating, phase, tc_user_id, version, create_time, project_id) VALUES (80000003, 40000003, 400011, 'Cool3', 1, 0, 113, 400011, 1, current, 40000003); + +INSERT INTO project_result (user_id, project_id, old_rating, new_rating, raw_score, final_score, payment, placed, rating_ind, valid_submission_ind, create_date, modify_date, passed_review_ind, point_adjustment, rating_order) VALUES (400011, 40000003, 0, 1, 80, 90, 1, 0, 0, 0, current, current, 1, 1, 1); + +INSERT INTO comp_jive_category_xref (comp_vers_id, jive_category_id) VALUES ('40000003', 1003); + +INSERT INTO comp_version_dates_history (comp_version_dates_history_id, comp_vers_id, phase_id , initial_submission_date) VALUES (40000003, 40000003, 113, CURRENT); + +INSERT INTO project_phase (project_phase_id, project_id, phase_type_id, phase_status_id, fixed_start_time, scheduled_start_time, scheduled_end_time, actual_start_time, actual_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (40000003, 40000003, 1, 2, null, CURRENT + -44640 UNITS MINUTE, CURRENT + -36000 UNITS MINUTE, CURRENT + -44640 UNITS MINUTE, null, 518400000, 132456, CURRENT, 132456, CURRENT); + +INSERT INTO copilot_profile(copilot_profile_id, user_id, copilot_profile_status_id, suspension_count, reliability, create_user, create_date, update_user, update_date) +VALUES(400011, 400011, 1, 1, 50, 132456, CURRENT, 132456, CURRENT); diff --git a/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data.json b/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data.json new file mode 100755 index 000000000..b47388df7 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__insert_test_data", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__insert_test_data" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data.sql b/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data.sql new file mode 100755 index 000000000..74d5c4d62 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__insert_test_data.sql @@ -0,0 +1,40 @@ +INSERT INTO project (project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id, project_studio_spec_id) VALUES (40000001, 1, 2, 132456, CURRENT, 132456, CURRENT, 40000011, null); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000001, 6, 'Java Throttle 1.0', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000001, 2, '40000001', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO comp_catalog (component_id, current_version, short_desc, component_name, description, function_desc, create_time, status_id, root_category_id, modify_date, public_ind) VALUES ('40000001', '1', 'Coolest component ever', 'Component 4', 'Coolest component ever', 'Component', CURRENT, '1', '5801776', CURRENT, '0'); + +INSERT INTO comp_versions (comp_vers_id, component_id, version, version_text, create_time, phase_id, phase_time, price, comments, modify_date, suspended_ind) VALUES ('40000001', '40000001', '1', '1.0', CURRENT, '113', '1976-05-04 00:00:00.0', '1000.00', 'Cool', CURRENT, '0'); + +INSERT INTO comp_jive_category_xref (comp_vers_id, jive_category_id) VALUES ('40000001', 1001); + +INSERT INTO comp_version_dates_history (comp_version_dates_history_id, comp_vers_id, phase_id , initial_submission_date) VALUES (40000001, 40000001, 113, CURRENT); + +INSERT INTO project_studio_specification(project_studio_spec_id,contest_description,create_user,create_date,modify_user,modify_date) VALUES (1,'Description of Studio Contest 40000002.','132456',CURRENT,'132456',CURRENT); + +INSERT INTO project_phase (project_phase_id, project_id, phase_type_id, phase_status_id, fixed_start_time, scheduled_start_time, scheduled_end_time, actual_start_time, actual_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (40000001, 40000001, 1, 2, null, CURRENT + -44640 UNITS MINUTE, CURRENT + -36000 UNITS MINUTE, CURRENT + -44640 UNITS MINUTE, null, 518400000, 132456, CURRENT, 132456, CURRENT); + +INSERT INTO project (project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id, project_studio_spec_id) VALUES (40000002, 1, 20, 132456, CURRENT, 132456, CURRENT, 40000012, 1); + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000002, 6, 'Hestia Business Information', 132456, CURRENT, 132456, CURRENT); + + +INSERT INTO project_info (project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES (40000002, 2, '40000002', 132456, CURRENT, 132456, CURRENT); + +INSERT INTO comp_catalog (component_id, current_version, short_desc, component_name, description, function_desc, create_time, status_id, root_category_id, modify_date, public_ind) VALUES ('40000002', '1', 'Coolest component ever', 'Component 4', 'Coolest component ever', 'Component', CURRENT, '1', '5801776', CURRENT, '0'); + +INSERT INTO comp_versions (comp_vers_id, component_id, version, version_text, create_time, phase_id, phase_time, price, comments, modify_date, suspended_ind) VALUES ('40000002', '40000002', '1', '1.0', CURRENT, '131', '1976-05-04 00:00:00.0', '1000.00', 'Cool', CURRENT, '0'); + +INSERT INTO comp_jive_category_xref (comp_vers_id, jive_category_id) VALUES ('40000002', 1002); + +INSERT INTO project_phase (project_phase_id, project_id, phase_type_id, phase_status_id, fixed_start_time, scheduled_start_time, scheduled_end_time, actual_start_time, actual_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (40000002, 40000002, 1, 2, null, CURRENT + -44640 UNITS MINUTE, CURRENT + -36000 UNITS MINUTE, CURRENT + -44640 UNITS MINUTE, null, 518400000, 132456, CURRENT, 132456, CURRENT); + +INSERT INTO user_rating (user_id, rating, phase_id, last_rated_project_id) values (400011, 0, 113, null); + +INSERT INTO user_reliability (user_id, rating, phase_id) values (400011, null, 113); + +INSERT INTO user_rating (user_id, rating, phase_id, last_rated_project_id) values (400011, 3000, 131, 40000003); + +INSERT INTO user_reliability (user_id, rating, phase_id) values (400011, 1.00, 131); \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_component_inquiry b/test/sqls/challengeUnregistration/tcs_catalog__select_component_inquiry new file mode 100755 index 000000000..3793443f6 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_component_inquiry @@ -0,0 +1 @@ +* FROM component_inquiry WHERE component_id = 40000001; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_component_inquiry.json b/test/sqls/challengeUnregistration/tcs_catalog__select_component_inquiry.json new file mode 100755 index 000000000..ae723df78 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_component_inquiry.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__select_component_inquiry", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__select_component_inquiry" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_project_result b/test/sqls/challengeUnregistration/tcs_catalog__select_project_result new file mode 100755 index 000000000..2a8336566 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_project_result @@ -0,0 +1 @@ +* FROM project_result WHERE project_id = 40000001; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_project_result.json b/test/sqls/challengeUnregistration/tcs_catalog__select_project_result.json new file mode 100755 index 000000000..e708f40a1 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_project_result.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__select_project_result", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__select_project_result" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_component_inquiry b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_component_inquiry new file mode 100755 index 000000000..75b960cb7 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_component_inquiry @@ -0,0 +1 @@ +* FROM component_inquiry WHERE project_id = 40000001; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_component_inquiry.json b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_component_inquiry.json new file mode 100755 index 000000000..ba02d2d5e --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_component_inquiry.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__select_software_challenge_component_inquiry", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__select_software_challenge_component_inquiry" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource new file mode 100755 index 000000000..e538ec1ee --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource @@ -0,0 +1 @@ +* FROM resource WHERE project_id = 40000001; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource.json b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource.json new file mode 100755 index 000000000..816144594 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__select_software_challenge_resource", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__select_software_challenge_resource" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource_info b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource_info new file mode 100755 index 000000000..c6a7175b2 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource_info @@ -0,0 +1,3 @@ +(SELECT i.value FROM resource_info i WHERE r.resource_id = i.resource_id AND i.resource_info_type_id = 1 ) AS user_id, +(SELECT i.value FROM resource_info i WHERE r.resource_id = i.resource_id AND i.resource_info_type_id = 2 ) AS handle +FROM resource r WHERE project_id = 40000001; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource_info.json b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource_info.json new file mode 100755 index 000000000..5e5123c56 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_software_challenge_resource_info.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__select_software_challenge_resource_info", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__select_software_challenge_resource_info" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource new file mode 100755 index 000000000..b0d456f35 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource @@ -0,0 +1 @@ +* FROM resource WHERE project_id = 40000002; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource.json b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource.json new file mode 100755 index 000000000..e0ce21a71 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__select_studio_challenge_resource", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__select_studio_challenge_resource" +} \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource_info b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource_info new file mode 100755 index 000000000..b50384897 --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource_info @@ -0,0 +1,4 @@ +(SELECT i.value FROM resource_info i WHERE r.resource_id = i.resource_id AND i.resource_info_type_id = 1 ) AS user_id, +(SELECT i.value FROM resource_info i WHERE r.resource_id = i.resource_id AND i.resource_info_type_id = 2 ) AS handle, +(SELECT i.value FROM resource_info i WHERE r.resource_id = i.resource_id AND i.resource_info_type_id = 8 ) AS payments +FROM resource r WHERE project_id = 40000002; \ No newline at end of file diff --git a/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource_info.json b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource_info.json new file mode 100755 index 000000000..fbe5a466f --- /dev/null +++ b/test/sqls/challengeUnregistration/tcs_catalog__select_studio_challenge_resource_info.json @@ -0,0 +1,5 @@ +{ + "name" : "tcs_catalog__select_studio_challenge_resource_info", + "db" : "tcs_catalog", + "sqlfile" : "tcs_catalog__select_studio_challenge_resource_info" +} \ No newline at end of file diff --git a/test/sqls/docusign/callback/common_oltp__clean b/test/sqls/docusign/callback/common_oltp__clean new file mode 100644 index 000000000..83fdf3db7 --- /dev/null +++ b/test/sqls/docusign/callback/common_oltp__clean @@ -0,0 +1,2 @@ +delete from user_terms_of_use_xref where user_id IN (132456, 124764) and terms_of_use_id = 20753; +delete from user_terms_of_use_ban_xref where user_id = 124772 and terms_of_use_id = 20753; \ No newline at end of file diff --git a/test/sqls/docusign/callback/common_oltp__insert_test_data b/test/sqls/docusign/callback/common_oltp__insert_test_data new file mode 100644 index 000000000..0c2fb18a8 --- /dev/null +++ b/test/sqls/docusign/callback/common_oltp__insert_test_data @@ -0,0 +1,2 @@ +INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id, create_date, modify_date) VALUES(132456, 20753, '2013-12-12 00:00:00', '2013-12-12 00:00:00'); +INSERT INTO user_terms_of_use_ban_xref(user_id, terms_of_use_id) VALUES(124772, 20753); \ No newline at end of file diff --git a/test/sqls/docusign/callback/informixoltp__clean b/test/sqls/docusign/callback/informixoltp__clean new file mode 100755 index 000000000..33e45ec0b --- /dev/null +++ b/test/sqls/docusign/callback/informixoltp__clean @@ -0,0 +1,2 @@ +DELETE FROM docusign_envelope +WHERE docusign_envelope_id IN ('9E045DB0-B50F-11E3-A5E2-0800200C9A66', '32A09D40-B51E-11E3-A5E2-0800200C9A66', 'AD6212F0-B525-11E3-A5E2-0800200C9A66', '4E0E0DB0-B528-11E3-A5E2-0800200C9A66'); \ No newline at end of file diff --git a/test/sqls/docusign/callback/informixoltp__insert_test_data b/test/sqls/docusign/callback/informixoltp__insert_test_data new file mode 100644 index 000000000..d404d56b1 --- /dev/null +++ b/test/sqls/docusign/callback/informixoltp__insert_test_data @@ -0,0 +1,4 @@ +INSERT INTO docusign_envelope(docusign_envelope_id, docusign_template_id, user_id, is_completed) VALUES('9E045DB0-B50F-11E3-A5E2-0800200C9A66', 'E12C78DE-67B1-4150-BEC8-C44CE20A2F0B', 124764, 0); +INSERT INTO docusign_envelope(docusign_envelope_id, docusign_template_id, user_id, is_completed) VALUES('32A09D40-B51E-11E3-A5E2-0800200C9A66', 'E12C78DE-67B1-4150-BEC8-C44CE20A2F0A', 124764, 0); +INSERT INTO docusign_envelope(docusign_envelope_id, docusign_template_id, user_id, is_completed) VALUES('AD6212F0-B525-11E3-A5E2-0800200C9A66', 'E12C78DE-67B1-4150-BEC8-C44CE20A2F0B', 132456, 0); +INSERT INTO docusign_envelope(docusign_envelope_id, docusign_template_id, user_id, is_completed) VALUES('4E0E0DB0-B528-11E3-A5E2-0800200C9A66', 'E12C78DE-67B1-4150-BEC8-C44CE20A2F0B', 124772, 0); \ No newline at end of file diff --git a/test/sqls/getChallengesRSS/informixoltp__clean b/test/sqls/getChallengesRSS/informixoltp__clean new file mode 100644 index 000000000..97f765c8a --- /dev/null +++ b/test/sqls/getChallengesRSS/informixoltp__clean @@ -0,0 +1,8 @@ +DELETE FROM round_segment; +DELETE FROM round_registration; +DELETE FROM room; +DELETE FROM round_component; +DELETE FROM round_room_assignment; +DELETE FROM round_terms; +DELETE FROM round; +DELETE FROM contest; diff --git a/test/sqls/getChallengesRSS/informixoltp__insert_test_data b/test/sqls/getChallengesRSS/informixoltp__insert_test_data new file mode 100644 index 000000000..13b1790bf --- /dev/null +++ b/test/sqls/getChallengesRSS/informixoltp__insert_test_data @@ -0,0 +1,60 @@ +INSERT INTO contest(contest_id, name) VALUES(2001, 'Test Active marathon contest 2001'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2001, 2001, 'Test Active Marathon Contest 2001', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2001, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2002, 'Test Active marathon contest 2002'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2002, 2002, 'Test Active Marathon Contest 2002', 19); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2002, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2003, 'Test Active marathon contest 2003'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2003, 2003, 'Test Active Marathon Contest 2003', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2003, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2004, 'Test Active marathon contest 2004'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2004, 2004, 'Test Active Marathon Contest 2004', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2004, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2005, 'Test Active marathon contest 2005'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2005, 2005, 'Test Active Marathon Contest 2005', 19); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2005, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2006, 'Test Active marathon contest 2006'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2006, 2006, 'Test Active Marathon Contest 2006', 13); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2006, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2007, 'Test Active marathon contest 2007'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2007, 2007, 'Test Active Marathon Contest 2007', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2007, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2008, 'Test Active marathon contest 2008'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2008, 2008, 'Test Active Marathon Contest 2008', 19); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2008, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2009, 'Test Active marathon contest 2009'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2009, 2009, 'Test Active Marathon Contest 2009', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2009, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2010, 'Test Active marathon contest 2010'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2010, 2010, 'Test Active Marathon Contest 2010', 13); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2010, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2011, 'Test Active marathon contest 2011'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2011, 2011, 'Test Active Marathon Contest 2011', 15); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2011, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2012, 'Test Active marathon contest 2012'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2012, 2012, 'Test Active Marathon Contest 2012', 19); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2012, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2013, 'Test Active marathon contest 2013'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2013, 2013, 'Test Active Marathon Contest 2013', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2013, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2014, 'Test Active marathon contest 2014'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2014, 2014, 'Test Active Marathon Contest 2014', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2014, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2015, 'Test Active marathon contest 2015'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2015, 2015, 'Test Active Marathon Contest 2015', 13); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2015, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2016, 'Test Active marathon contest 2016'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2016, 2016, 'Test Active Marathon Contest 2016', 15); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2016, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2017, 'Test Active marathon contest 2017'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2017, 2017, 'Test Active Marathon Contest 2017', 19); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2017, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2018, 'Test Active marathon contest 2018'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2018, 2018, 'Test Active Marathon Contest 2018', 15); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2018, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2019, 'Test Active marathon contest 2019'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2019, 2019, 'Test Active Marathon Contest 2019', 15); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2019, 2, current - 1 units day, current + 1 units day, 'P'); +INSERT INTO contest(contest_id, name) VALUES(2020, 'Test Active marathon contest 2020'); +INSERT INTO round(round_id, contest_id, name, round_type_id) VALUES(2020, 2020, 'Test Active Marathon Contest 2020', 22); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2020, 2, current - 1 units day, current + 1 units day, 'P'); diff --git a/test/sqls/getChallengesRSS/tcs_catalog__clean b/test/sqls/getChallengesRSS/tcs_catalog__clean new file mode 100644 index 000000000..d4b75564e --- /dev/null +++ b/test/sqls/getChallengesRSS/tcs_catalog__clean @@ -0,0 +1,14 @@ +DELETE FROM resource_info; +DELETE FROM resource; +DELETE FROM component_inquiry; +DELETE FROM phase_criteria; +DELETE FROM phase_dependency; +DELETE FROM project_phase; +DELETE FROM project_platform; +DELETE FROM prize; +DELETE FROM group_contest_eligibility; +DELETE FROM contest_eligibility; +DELETE FROM project_spec; +DELETE FROM project_info; +DELETE FROM project; +DELETE FROM project_studio_specification; diff --git a/test/sqls/getChallengesRSS/tcs_catalog__insert_test_data.part1 b/test/sqls/getChallengesRSS/tcs_catalog__insert_test_data.part1 new file mode 100644 index 000000000..af715e79f --- /dev/null +++ b/test/sqls/getChallengesRSS/tcs_catalog__insert_test_data.part1 @@ -0,0 +1,280 @@ +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2001, 1, 35, 132456, CURRENT, 132456, CURRENT, 2001); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2001, 6, 'ACTIVE Software Challenge 2001', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2001, 2001, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2001, 2001, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2002, 1, 25, 132456, CURRENT, 132456, CURRENT, 2002); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2002, 6, 'ACTIVE Software Challenge 2002', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2002, 2002, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2002, 2002, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2003, 1, 13, 132456, CURRENT, 132456, CURRENT, 2003); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2003, 6, 'ACTIVE Software Challenge 2003', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2003, 2003, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2003, 2003, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2004, 1, 25, 132456, CURRENT, 132456, CURRENT, 2004); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2004, 6, 'ACTIVE Software Challenge 2004', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2004, 2004, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2004, 2004, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2005, 1, 14, 132456, CURRENT, 132456, CURRENT, 2005); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2005, 6, 'ACTIVE Software Challenge 2005', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2005, 2005, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2005, 2005, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2006, 1, 13, 132456, CURRENT, 132456, CURRENT, 2006); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2006, 6, 'ACTIVE Software Challenge 2006', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2006, 2006, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2006, 2006, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2007, 1, 39, 132456, CURRENT, 132456, CURRENT, 2007); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2007, 6, 'ACTIVE Software Challenge 2007', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2007, 2007, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2007, 2007, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2008, 1, 38, 132456, CURRENT, 132456, CURRENT, 2008); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2008, 6, 'ACTIVE Software Challenge 2008', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2008, 2008, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2008, 2008, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2009, 1, 2, 132456, CURRENT, 132456, CURRENT, 2009); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2009, 6, 'ACTIVE Software Challenge 2009', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2009, 2009, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2009, 2009, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2010, 1, 36, 132456, CURRENT, 132456, CURRENT, 2010); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2010, 6, 'ACTIVE Software Challenge 2010', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2010, 2010, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2010, 2010, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2011, 1, 19, 132456, CURRENT, 132456, CURRENT, 2011); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2011, 6, 'ACTIVE Software Challenge 2011', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2011, 2011, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2011, 2011, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2012, 1, 9, 132456, CURRENT, 132456, CURRENT, 2012); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2012, 6, 'ACTIVE Software Challenge 2012', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2012, 2012, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2012, 2012, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2013, 1, 35, 132456, CURRENT, 132456, CURRENT, 2013); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2013, 6, 'ACTIVE Software Challenge 2013', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2013, 2013, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2013, 2013, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2014, 1, 38, 132456, CURRENT, 132456, CURRENT, 2014); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2014, 6, 'ACTIVE Software Challenge 2014', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2014, 2014, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2014, 2014, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2015, 1, 19, 132456, CURRENT, 132456, CURRENT, 2015); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2015, 6, 'ACTIVE Software Challenge 2015', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2015, 2015, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2015, 2015, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2016, 1, 2, 132456, CURRENT, 132456, CURRENT, 2016); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2016, 6, 'ACTIVE Software Challenge 2016', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2016, 2016, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2016, 2016, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2017, 1, 36, 132456, CURRENT, 132456, CURRENT, 2017); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2017, 6, 'ACTIVE Software Challenge 2017', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2017, 2017, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2017, 2017, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2018, 1, 23, 132456, CURRENT, 132456, CURRENT, 2018); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2018, 6, 'ACTIVE Software Challenge 2018', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2018, 2018, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2018, 2018, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2019, 1, 25, 132456, CURRENT, 132456, CURRENT, 2019); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2019, 6, 'ACTIVE Software Challenge 2019', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2019, 2019, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2019, 2019, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2020, 1, 25, 132456, CURRENT, 132456, CURRENT, 2020); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2020, 6, 'ACTIVE Software Challenge 2020', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2020, 2020, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2020, 2020, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2021, 1, 2, 132456, CURRENT, 132456, CURRENT, 2021); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2021, 6, 'OPEN Software Challenge 2021', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2021, 2021, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2021, 2021, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2022, 1, 25, 132456, CURRENT, 132456, CURRENT, 2022); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2022, 6, 'OPEN Software Challenge 2022', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2022, 2022, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2022, 2022, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2023, 1, 35, 132456, CURRENT, 132456, CURRENT, 2023); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2023, 6, 'OPEN Software Challenge 2023', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2023, 2023, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2023, 2023, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2024, 1, 13, 132456, CURRENT, 132456, CURRENT, 2024); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2024, 6, 'OPEN Software Challenge 2024', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2024, 2024, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2024, 2024, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2025, 1, 7, 132456, CURRENT, 132456, CURRENT, 2025); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2025, 6, 'OPEN Software Challenge 2025', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2025, 2025, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2025, 2025, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2026, 1, 25, 132456, CURRENT, 132456, CURRENT, 2026); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2026, 6, 'OPEN Software Challenge 2026', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2026, 2026, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2026, 2026, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2027, 1, 39, 132456, CURRENT, 132456, CURRENT, 2027); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2027, 6, 'OPEN Software Challenge 2027', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2027, 2027, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2027, 2027, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2028, 1, 23, 132456, CURRENT, 132456, CURRENT, 2028); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2028, 6, 'OPEN Software Challenge 2028', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2028, 2028, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2028, 2028, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2029, 1, 36, 132456, CURRENT, 132456, CURRENT, 2029); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2029, 6, 'OPEN Software Challenge 2029', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2029, 2029, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2029, 2029, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2030, 1, 25, 132456, CURRENT, 132456, CURRENT, 2030); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2030, 6, 'OPEN Software Challenge 2030', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2030, 2030, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2030, 2030, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2031, 1, 7, 132456, CURRENT, 132456, CURRENT, 2031); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2031, 6, 'OPEN Software Challenge 2031', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2031, 2031, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2031, 2031, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2032, 1, 25, 132456, CURRENT, 132456, CURRENT, 2032); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2032, 6, 'OPEN Software Challenge 2032', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2032, 2032, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2032, 2032, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2033, 1, 38, 132456, CURRENT, 132456, CURRENT, 2033); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2033, 6, 'OPEN Software Challenge 2033', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2033, 2033, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2033, 2033, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2034, 1, 36, 132456, CURRENT, 132456, CURRENT, 2034); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2034, 6, 'OPEN Software Challenge 2034', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2034, 2034, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2034, 2034, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2035, 1, 25, 132456, CURRENT, 132456, CURRENT, 2035); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2035, 6, 'OPEN Software Challenge 2035', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2035, 2035, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2035, 2035, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2036, 1, 13, 132456, CURRENT, 132456, CURRENT, 2036); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2036, 6, 'OPEN Software Challenge 2036', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2036, 2036, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2036, 2036, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2037, 1, 24, 132456, CURRENT, 132456, CURRENT, 2037); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2037, 6, 'OPEN Software Challenge 2037', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2037, 2037, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2037, 2037, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2038, 1, 2, 132456, CURRENT, 132456, CURRENT, 2038); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2038, 6, 'OPEN Software Challenge 2038', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2038, 2038, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2038, 2038, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2039, 1, 24, 132456, CURRENT, 132456, CURRENT, 2039); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2039, 6, 'OPEN Software Challenge 2039', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2039, 2039, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2039, 2039, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2040, 1, 26, 132456, CURRENT, 132456, CURRENT, 2040); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2040, 6, 'OPEN Software Challenge 2040', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2040, 2040, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2040, 2040, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2041, 2, 25, 132456, CURRENT, 132456, CURRENT, 2041); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2041, 6, 'UPCOMING Software Challenge 2041', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2041, 2041, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2041, 2041, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2042, 2, 19, 132456, CURRENT, 132456, CURRENT, 2042); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2042, 6, 'UPCOMING Software Challenge 2042', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2042, 2042, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2042, 2042, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2043, 2, 19, 132456, CURRENT, 132456, CURRENT, 2043); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2043, 6, 'UPCOMING Software Challenge 2043', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2043, 2043, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2043, 2043, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2044, 2, 1, 132456, CURRENT, 132456, CURRENT, 2044); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2044, 6, 'UPCOMING Software Challenge 2044', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2044, 2044, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2044, 2044, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2045, 2, 2, 132456, CURRENT, 132456, CURRENT, 2045); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2045, 6, 'UPCOMING Software Challenge 2045', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2045, 2045, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2045, 2045, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2046, 2, 24, 132456, CURRENT, 132456, CURRENT, 2046); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2046, 6, 'UPCOMING Software Challenge 2046', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2046, 2046, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2046, 2046, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2047, 2, 14, 132456, CURRENT, 132456, CURRENT, 2047); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2047, 6, 'UPCOMING Software Challenge 2047', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2047, 2047, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2047, 2047, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2048, 2, 13, 132456, CURRENT, 132456, CURRENT, 2048); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2048, 6, 'UPCOMING Software Challenge 2048', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2048, 2048, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2048, 2048, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2049, 2, 39, 132456, CURRENT, 132456, CURRENT, 2049); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2049, 6, 'UPCOMING Software Challenge 2049', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2049, 2049, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2049, 2049, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2050, 2, 19, 132456, CURRENT, 132456, CURRENT, 2050); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2050, 6, 'UPCOMING Software Challenge 2050', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2050, 2050, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2050, 2050, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2051, 2, 9, 132456, CURRENT, 132456, CURRENT, 2051); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2051, 6, 'UPCOMING Software Challenge 2051', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2051, 2051, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2051, 2051, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2052, 2, 9, 132456, CURRENT, 132456, CURRENT, 2052); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2052, 6, 'UPCOMING Software Challenge 2052', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2052, 2052, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2052, 2052, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2053, 2, 36, 132456, CURRENT, 132456, CURRENT, 2053); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2053, 6, 'UPCOMING Software Challenge 2053', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2053, 2053, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2053, 2053, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2054, 2, 6, 132456, CURRENT, 132456, CURRENT, 2054); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2054, 6, 'UPCOMING Software Challenge 2054', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2054, 2054, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2054, 2054, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2055, 2, 2, 132456, CURRENT, 132456, CURRENT, 2055); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2055, 6, 'UPCOMING Software Challenge 2055', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2055, 2055, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2055, 2055, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2056, 2, 6, 132456, CURRENT, 132456, CURRENT, 2056); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2056, 6, 'UPCOMING Software Challenge 2056', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2056, 2056, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2056, 2056, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2057, 2, 2, 132456, CURRENT, 132456, CURRENT, 2057); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2057, 6, 'UPCOMING Software Challenge 2057', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2057, 2057, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2057, 2057, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2058, 2, 26, 132456, CURRENT, 132456, CURRENT, 2058); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2058, 6, 'UPCOMING Software Challenge 2058', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2058, 2058, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2058, 2058, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2059, 2, 14, 132456, CURRENT, 132456, CURRENT, 2059); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2059, 6, 'UPCOMING Software Challenge 2059', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2059, 2059, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2059, 2059, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2060, 2, 19, 132456, CURRENT, 132456, CURRENT, 2060); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2060, 6, 'UPCOMING Software Challenge 2060', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2060, 2060, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2060, 2060, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2061, 5, 6, 132456, CURRENT, 132456, CURRENT, 2061); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2061, 6, 'PAST Software Challenge 2061', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2061, 2061, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2061, 2061, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2062, 8, 14, 132456, CURRENT, 132456, CURRENT, 2062); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2062, 6, 'PAST Software Challenge 2062', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2062, 2062, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2062, 2062, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2063, 4, 35, 132456, CURRENT, 132456, CURRENT, 2063); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2063, 6, 'PAST Software Challenge 2063', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2063, 2063, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2063, 2063, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2064, 8, 13, 132456, CURRENT, 132456, CURRENT, 2064); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2064, 6, 'PAST Software Challenge 2064', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2064, 2064, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2064, 2064, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2065, 11, 14, 132456, CURRENT, 132456, CURRENT, 2065); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2065, 6, 'PAST Software Challenge 2065', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2065, 2065, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2065, 2065, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2066, 8, 6, 132456, CURRENT, 132456, CURRENT, 2066); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2066, 6, 'PAST Software Challenge 2066', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2066, 2066, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2066, 2066, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2067, 10, 26, 132456, CURRENT, 132456, CURRENT, 2067); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2067, 6, 'PAST Software Challenge 2067', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2067, 2067, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2067, 2067, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2068, 11, 1, 132456, CURRENT, 132456, CURRENT, 2068); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2068, 6, 'PAST Software Challenge 2068', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2068, 2068, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2068, 2068, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2069, 8, 26, 132456, CURRENT, 132456, CURRENT, 2069); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2069, 6, 'PAST Software Challenge 2069', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2069, 2069, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2069, 2069, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2070, 9, 23, 132456, CURRENT, 132456, CURRENT, 2070); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2070, 6, 'PAST Software Challenge 2070', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2070, 2070, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2070, 2070, 1); diff --git a/test/sqls/getChallengesRSS/tcs_catalog__insert_test_data.part2 b/test/sqls/getChallengesRSS/tcs_catalog__insert_test_data.part2 new file mode 100644 index 000000000..8ef56cbab --- /dev/null +++ b/test/sqls/getChallengesRSS/tcs_catalog__insert_test_data.part2 @@ -0,0 +1,280 @@ +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2071, 9, 6, 132456, CURRENT, 132456, CURRENT, 2071); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2071, 6, 'PAST Software Challenge 2071', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2071, 2071, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2071, 2071, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2072, 5, 39, 132456, CURRENT, 132456, CURRENT, 2072); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2072, 6, 'PAST Software Challenge 2072', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2072, 2072, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2072, 2072, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2073, 10, 1, 132456, CURRENT, 132456, CURRENT, 2073); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2073, 6, 'PAST Software Challenge 2073', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2073, 2073, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2073, 2073, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2074, 9, 14, 132456, CURRENT, 132456, CURRENT, 2074); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2074, 6, 'PAST Software Challenge 2074', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2074, 2074, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2074, 2074, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2075, 9, 38, 132456, CURRENT, 132456, CURRENT, 2075); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2075, 6, 'PAST Software Challenge 2075', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2075, 2075, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2075, 2075, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2076, 10, 35, 132456, CURRENT, 132456, CURRENT, 2076); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2076, 6, 'PAST Software Challenge 2076', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2076, 2076, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2076, 2076, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2077, 8, 25, 132456, CURRENT, 132456, CURRENT, 2077); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2077, 6, 'PAST Software Challenge 2077', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2077, 2077, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2077, 2077, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2078, 4, 23, 132456, CURRENT, 132456, CURRENT, 2078); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2078, 6, 'PAST Software Challenge 2078', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2078, 2078, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2078, 2078, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2079, 5, 6, 132456, CURRENT, 132456, CURRENT, 2079); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2079, 6, 'PAST Software Challenge 2079', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2079, 2079, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2079, 2079, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2080, 4, 26, 132456, CURRENT, 132456, CURRENT, 2080); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2080, 6, 'PAST Software Challenge 2080', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2080, 2080, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_spec(project_spec_id, project_id, version) VALUES(2080, 2080, 1); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2081, 1, 32, 132456, CURRENT, 132456, CURRENT, 2081); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2081, 6, 'ACTIVE Studio Challenge 2081', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2081, 2081, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2082, 1, 20, 132456, CURRENT, 132456, CURRENT, 2082); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2082, 6, 'ACTIVE Studio Challenge 2082', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2082, 2082, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2083, 1, 31, 132456, CURRENT, 132456, CURRENT, 2083); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2083, 6, 'ACTIVE Studio Challenge 2083', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2083, 2083, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2084, 1, 16, 132456, CURRENT, 132456, CURRENT, 2084); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2084, 6, 'ACTIVE Studio Challenge 2084', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2084, 2084, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2085, 1, 30, 132456, CURRENT, 132456, CURRENT, 2085); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2085, 6, 'ACTIVE Studio Challenge 2085', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2085, 2085, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2086, 1, 21, 132456, CURRENT, 132456, CURRENT, 2086); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2086, 6, 'ACTIVE Studio Challenge 2086', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2086, 2086, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2087, 1, 18, 132456, CURRENT, 132456, CURRENT, 2087); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2087, 6, 'ACTIVE Studio Challenge 2087', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2087, 2087, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2088, 1, 32, 132456, CURRENT, 132456, CURRENT, 2088); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2088, 6, 'ACTIVE Studio Challenge 2088', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2088, 2088, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2089, 1, 22, 132456, CURRENT, 132456, CURRENT, 2089); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2089, 6, 'ACTIVE Studio Challenge 2089', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2089, 2089, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2090, 1, 20, 132456, CURRENT, 132456, CURRENT, 2090); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2090, 6, 'ACTIVE Studio Challenge 2090', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2090, 2090, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2091, 1, 34, 132456, CURRENT, 132456, CURRENT, 2091); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2091, 6, 'ACTIVE Studio Challenge 2091', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2091, 2091, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2092, 1, 34, 132456, CURRENT, 132456, CURRENT, 2092); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2092, 6, 'ACTIVE Studio Challenge 2092', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2092, 2092, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2093, 1, 32, 132456, CURRENT, 132456, CURRENT, 2093); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2093, 6, 'ACTIVE Studio Challenge 2093', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2093, 2093, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2094, 1, 17, 132456, CURRENT, 132456, CURRENT, 2094); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2094, 6, 'ACTIVE Studio Challenge 2094', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2094, 2094, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2095, 1, 16, 132456, CURRENT, 132456, CURRENT, 2095); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2095, 6, 'ACTIVE Studio Challenge 2095', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2095, 2095, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2096, 1, 16, 132456, CURRENT, 132456, CURRENT, 2096); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2096, 6, 'ACTIVE Studio Challenge 2096', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2096, 2096, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2097, 1, 20, 132456, CURRENT, 132456, CURRENT, 2097); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2097, 6, 'ACTIVE Studio Challenge 2097', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2097, 2097, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2098, 1, 32, 132456, CURRENT, 132456, CURRENT, 2098); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2098, 6, 'ACTIVE Studio Challenge 2098', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2098, 2098, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2099, 1, 20, 132456, CURRENT, 132456, CURRENT, 2099); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2099, 6, 'ACTIVE Studio Challenge 2099', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2099, 2099, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2100, 1, 18, 132456, CURRENT, 132456, CURRENT, 2100); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2100, 6, 'ACTIVE Studio Challenge 2100', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2100, 2100, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2101, 1, 21, 132456, CURRENT, 132456, CURRENT, 2101); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2101, 6, 'OPEN Studio Challenge 2101', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2101, 2101, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2102, 1, 21, 132456, CURRENT, 132456, CURRENT, 2102); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2102, 6, 'OPEN Studio Challenge 2102', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2102, 2102, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2103, 1, 30, 132456, CURRENT, 132456, CURRENT, 2103); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2103, 6, 'OPEN Studio Challenge 2103', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2103, 2103, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2104, 1, 18, 132456, CURRENT, 132456, CURRENT, 2104); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2104, 6, 'OPEN Studio Challenge 2104', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2104, 2104, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2105, 1, 18, 132456, CURRENT, 132456, CURRENT, 2105); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2105, 6, 'OPEN Studio Challenge 2105', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2105, 2105, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2106, 1, 18, 132456, CURRENT, 132456, CURRENT, 2106); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2106, 6, 'OPEN Studio Challenge 2106', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2106, 2106, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2107, 1, 30, 132456, CURRENT, 132456, CURRENT, 2107); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2107, 6, 'OPEN Studio Challenge 2107', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2107, 2107, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2108, 1, 20, 132456, CURRENT, 132456, CURRENT, 2108); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2108, 6, 'OPEN Studio Challenge 2108', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2108, 2108, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2109, 1, 16, 132456, CURRENT, 132456, CURRENT, 2109); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2109, 6, 'OPEN Studio Challenge 2109', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2109, 2109, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2110, 1, 20, 132456, CURRENT, 132456, CURRENT, 2110); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2110, 6, 'OPEN Studio Challenge 2110', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2110, 2110, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2111, 1, 22, 132456, CURRENT, 132456, CURRENT, 2111); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2111, 6, 'OPEN Studio Challenge 2111', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2111, 2111, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2112, 1, 31, 132456, CURRENT, 132456, CURRENT, 2112); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2112, 6, 'OPEN Studio Challenge 2112', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2112, 2112, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2113, 1, 20, 132456, CURRENT, 132456, CURRENT, 2113); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2113, 6, 'OPEN Studio Challenge 2113', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2113, 2113, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2114, 1, 30, 132456, CURRENT, 132456, CURRENT, 2114); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2114, 6, 'OPEN Studio Challenge 2114', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2114, 2114, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2115, 1, 21, 132456, CURRENT, 132456, CURRENT, 2115); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2115, 6, 'OPEN Studio Challenge 2115', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2115, 2115, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2116, 1, 20, 132456, CURRENT, 132456, CURRENT, 2116); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2116, 6, 'OPEN Studio Challenge 2116', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2116, 2116, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2117, 1, 22, 132456, CURRENT, 132456, CURRENT, 2117); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2117, 6, 'OPEN Studio Challenge 2117', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2117, 2117, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2118, 1, 30, 132456, CURRENT, 132456, CURRENT, 2118); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2118, 6, 'OPEN Studio Challenge 2118', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2118, 2118, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2119, 1, 31, 132456, CURRENT, 132456, CURRENT, 2119); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2119, 6, 'OPEN Studio Challenge 2119', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2119, 2119, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2120, 1, 16, 132456, CURRENT, 132456, CURRENT, 2120); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2120, 6, 'OPEN Studio Challenge 2120', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2120, 2120, 1, 2, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2121, 2, 32, 132456, CURRENT, 132456, CURRENT, 2121); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2121, 6, 'UPCOMING Studio Challenge 2121', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2121, 2121, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2122, 2, 21, 132456, CURRENT, 132456, CURRENT, 2122); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2122, 6, 'UPCOMING Studio Challenge 2122', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2122, 2122, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2123, 2, 20, 132456, CURRENT, 132456, CURRENT, 2123); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2123, 6, 'UPCOMING Studio Challenge 2123', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2123, 2123, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2124, 2, 32, 132456, CURRENT, 132456, CURRENT, 2124); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2124, 6, 'UPCOMING Studio Challenge 2124', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2124, 2124, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2125, 2, 20, 132456, CURRENT, 132456, CURRENT, 2125); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2125, 6, 'UPCOMING Studio Challenge 2125', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2125, 2125, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2126, 2, 17, 132456, CURRENT, 132456, CURRENT, 2126); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2126, 6, 'UPCOMING Studio Challenge 2126', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2126, 2126, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2127, 2, 30, 132456, CURRENT, 132456, CURRENT, 2127); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2127, 6, 'UPCOMING Studio Challenge 2127', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2127, 2127, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2128, 2, 22, 132456, CURRENT, 132456, CURRENT, 2128); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2128, 6, 'UPCOMING Studio Challenge 2128', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2128, 2128, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2129, 2, 18, 132456, CURRENT, 132456, CURRENT, 2129); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2129, 6, 'UPCOMING Studio Challenge 2129', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2129, 2129, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2130, 2, 34, 132456, CURRENT, 132456, CURRENT, 2130); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2130, 6, 'UPCOMING Studio Challenge 2130', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2130, 2130, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2131, 2, 17, 132456, CURRENT, 132456, CURRENT, 2131); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2131, 6, 'UPCOMING Studio Challenge 2131', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2131, 2131, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2132, 2, 30, 132456, CURRENT, 132456, CURRENT, 2132); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2132, 6, 'UPCOMING Studio Challenge 2132', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2132, 2132, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2133, 2, 30, 132456, CURRENT, 132456, CURRENT, 2133); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2133, 6, 'UPCOMING Studio Challenge 2133', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2133, 2133, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2134, 2, 30, 132456, CURRENT, 132456, CURRENT, 2134); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2134, 6, 'UPCOMING Studio Challenge 2134', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2134, 2134, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2135, 2, 34, 132456, CURRENT, 132456, CURRENT, 2135); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2135, 6, 'UPCOMING Studio Challenge 2135', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2135, 2135, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2136, 2, 18, 132456, CURRENT, 132456, CURRENT, 2136); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2136, 6, 'UPCOMING Studio Challenge 2136', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2136, 2136, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2137, 2, 34, 132456, CURRENT, 132456, CURRENT, 2137); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2137, 6, 'UPCOMING Studio Challenge 2137', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2137, 2137, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2138, 2, 21, 132456, CURRENT, 132456, CURRENT, 2138); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2138, 6, 'UPCOMING Studio Challenge 2138', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2138, 2138, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2139, 2, 18, 132456, CURRENT, 132456, CURRENT, 2139); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2139, 6, 'UPCOMING Studio Challenge 2139', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2139, 2139, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2140, 2, 16, 132456, CURRENT, 132456, CURRENT, 2140); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2140, 6, 'UPCOMING Studio Challenge 2140', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2140, 2140, 1, 1, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2141, 8, 16, 132456, CURRENT, 132456, CURRENT, 2141); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2141, 6, 'PAST Studio Challenge 2141', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2141, 2141, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2142, 10, 30, 132456, CURRENT, 132456, CURRENT, 2142); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2142, 6, 'PAST Studio Challenge 2142', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2142, 2142, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2143, 11, 30, 132456, CURRENT, 132456, CURRENT, 2143); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2143, 6, 'PAST Studio Challenge 2143', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2143, 2143, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2144, 5, 18, 132456, CURRENT, 132456, CURRENT, 2144); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2144, 6, 'PAST Studio Challenge 2144', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2144, 2144, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2145, 9, 22, 132456, CURRENT, 132456, CURRENT, 2145); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2145, 6, 'PAST Studio Challenge 2145', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2145, 2145, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2146, 8, 34, 132456, CURRENT, 132456, CURRENT, 2146); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2146, 6, 'PAST Studio Challenge 2146', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2146, 2146, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2147, 4, 30, 132456, CURRENT, 132456, CURRENT, 2147); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2147, 6, 'PAST Studio Challenge 2147', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2147, 2147, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2148, 4, 32, 132456, CURRENT, 132456, CURRENT, 2148); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2148, 6, 'PAST Studio Challenge 2148', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2148, 2148, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2149, 7, 34, 132456, CURRENT, 132456, CURRENT, 2149); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2149, 6, 'PAST Studio Challenge 2149', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2149, 2149, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2150, 8, 31, 132456, CURRENT, 132456, CURRENT, 2150); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2150, 6, 'PAST Studio Challenge 2150', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2150, 2150, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2151, 10, 34, 132456, CURRENT, 132456, CURRENT, 2151); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2151, 6, 'PAST Studio Challenge 2151', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2151, 2151, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2152, 9, 30, 132456, CURRENT, 132456, CURRENT, 2152); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2152, 6, 'PAST Studio Challenge 2152', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2152, 2152, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2153, 7, 21, 132456, CURRENT, 132456, CURRENT, 2153); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2153, 6, 'PAST Studio Challenge 2153', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2153, 2153, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2154, 6, 31, 132456, CURRENT, 132456, CURRENT, 2154); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2154, 6, 'PAST Studio Challenge 2154', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2154, 2154, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2155, 8, 20, 132456, CURRENT, 132456, CURRENT, 2155); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2155, 6, 'PAST Studio Challenge 2155', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2155, 2155, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2156, 4, 32, 132456, CURRENT, 132456, CURRENT, 2156); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2156, 6, 'PAST Studio Challenge 2156', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2156, 2156, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2157, 10, 18, 132456, CURRENT, 132456, CURRENT, 2157); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2157, 6, 'PAST Studio Challenge 2157', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2157, 2157, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2158, 6, 20, 132456, CURRENT, 132456, CURRENT, 2158); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2158, 6, 'PAST Studio Challenge 2158', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2158, 2158, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2159, 11, 17, 132456, CURRENT, 132456, CURRENT, 2159); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2159, 6, 'PAST Studio Challenge 2159', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2159, 2159, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); +INSERT INTO project(project_id, project_status_id, project_category_id, create_user, create_date, modify_user, modify_date, tc_direct_project_id) VALUES(2160, 4, 32, 132456, CURRENT, 132456, CURRENT, 2160); +INSERT INTO project_info(project_id, project_info_type_id, value, create_user, create_date, modify_user, modify_date) VALUES(2160, 6, 'PAST Studio Challenge 2160', 132456, CURRENT, 132456, CURRENT); +INSERT INTO project_phase(project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES(2160, 2160, 1, 3, current, current, 86400000, 132456, CURRENT, 132456, CURRENT); diff --git a/test/sqls/getChallengesRSS/topcoder_dw__clean b/test/sqls/getChallengesRSS/topcoder_dw__clean new file mode 100644 index 000000000..050be8c41 --- /dev/null +++ b/test/sqls/getChallengesRSS/topcoder_dw__clean @@ -0,0 +1,5 @@ +DELETE FROM long_comp_result WHERE round_id >= 2001; +DELETE FROM round WHERE round_id >= 2001; +DELETE FROM contest; +DELETE FROM round_type_lu; +DELETE FROM algo_rating_type_lu; diff --git a/test/sqls/getChallengesRSS/topcoder_dw__insert_test_data b/test/sqls/getChallengesRSS/topcoder_dw__insert_test_data new file mode 100644 index 000000000..ef853441a --- /dev/null +++ b/test/sqls/getChallengesRSS/topcoder_dw__insert_test_data @@ -0,0 +1,127 @@ +INSERT INTO 'informix'.algo_rating_type_lu(algo_rating_type_id,algo_rating_type_desc) VALUES (1, 'TopCoder Rating'); +INSERT INTO 'informix'.algo_rating_type_lu(algo_rating_type_id,algo_rating_type_desc) VALUES (2, 'TopCoder High School Rating'); +INSERT INTO 'informix'.algo_rating_type_lu(algo_rating_type_id,algo_rating_type_desc) VALUES (3, 'Marathon Match Rating'); + +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (1, 'Single Round Match', 1); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (2, 'Tournament Round', 1); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (3, 'Practice Round', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (4, 'Moderated Chat Session', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (10, 'Long Round', 1); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (6, 'Screening Tool Problem Sets', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (11, 'Weakest Link Round', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (7, 'Team Single Round Match', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (8, 'Team Tournament Round', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (9, 'Team Practice Round', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (12, 'Private Label Tournament', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (13, 'Marathon Match', 3); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (14, 'Marathon Match Practice Round', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (15, 'Intel Marathon Match', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (16, 'Intel Marathon Match Practice Round', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (17, 'HS Single Round Match', 2); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (18, 'HS Tournament Round', 2); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (19, 'Marathon Match Tournament Round', 3); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (20, 'Intro Event Round', 1); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (21, 'Education Round', 1); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (22, 'AMD Marathon Match', NULL); +INSERT INTO 'informix'.round_type_lu(round_type_id,round_type_desc,algo_rating_type_id) VALUES (23, 'AMD Marathon Match Practice', NULL); + +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2001, 'Test Marathon contest 2001', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2001, 2001, 'Test round 2001', 'Test round 2001', 13, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2001, 132456, 1, 974922.8965988853, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2002, 'Test Marathon contest 2002', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2002, 2002, 'Test round 2002', 'Test round 2002', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2002, 132456, 1, 49737.41118415009, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2003, 'Test Marathon contest 2003', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2003, 2003, 'Test round 2003', 'Test round 2003', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2003, 132456, 1, 504204.9682969049, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2004, 'Test Marathon contest 2004', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2004, 2004, 'Test round 2004', 'Test round 2004', 19, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2004, 132456, 1, 920288.1540767809, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2005, 'Test Marathon contest 2005', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2005, 2005, 'Test round 2005', 'Test round 2005', 13, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2005, 132456, 1, 397550.64935013594, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2006, 'Test Marathon contest 2006', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2006, 2006, 'Test round 2006', 'Test round 2006', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2006, 132456, 1, 519110.7531203031, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2007, 'Test Marathon contest 2007', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2007, 2007, 'Test round 2007', 'Test round 2007', 10, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2007, 132456, 1, 279707.86328100873, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2008, 'Test Marathon contest 2008', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2008, 2008, 'Test round 2008', 'Test round 2008', 22, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2008, 132456, 1, 718631.2668664564, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2009, 'Test Marathon contest 2009', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2009, 2009, 'Test round 2009', 'Test round 2009', 13, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2009, 132456, 1, 42103.19839613341, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2010, 'Test Marathon contest 2010', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2010, 2010, 'Test round 2010', 'Test round 2010', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2010, 132456, 1, 580304.6665692491, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2011, 'Test Marathon contest 2011', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2011, 2011, 'Test round 2011', 'Test round 2011', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2011, 132456, 1, 239308.29692038125, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2012, 'Test Marathon contest 2012', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2012, 2012, 'Test round 2012', 'Test round 2012', 19, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2012, 132456, 1, 892495.495886823, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2013, 'Test Marathon contest 2013', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2013, 2013, 'Test round 2013', 'Test round 2013', 10, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2013, 132456, 1, 705667.1285777615, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2014, 'Test Marathon contest 2014', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2014, 2014, 'Test round 2014', 'Test round 2014', 22, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2014, 132456, 1, 178994.03940245096, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2015, 'Test Marathon contest 2015', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2015, 2015, 'Test round 2015', 'Test round 2015', 22, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2015, 132456, 1, 978449.5392321218, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2016, 'Test Marathon contest 2016', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2016, 2016, 'Test round 2016', 'Test round 2016', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2016, 132456, 1, 983280.6057243207, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2017, 'Test Marathon contest 2017', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2017, 2017, 'Test round 2017', 'Test round 2017', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2017, 132456, 1, 529446.8409910363, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2018, 'Test Marathon contest 2018', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2018, 2018, 'Test round 2018', 'Test round 2018', 19, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2018, 132456, 1, 904028.2070018143, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2019, 'Test Marathon contest 2019', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2019, 2019, 'Test round 2019', 'Test round 2019', 10, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2019, 132456, 1, 944730.0898643804, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2020, 'Test Marathon contest 2020', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id) VALUES(2020, 2020, 'Test round 2020', 'Test round 2020', 15, 0, 4017); +INSERT INTO long_comp_result(round_id, coder_id, placed, system_point_total, attended, num_submissions) VALUES(2020, 132456, 1, 891649.5556854985, 'Y', 2); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2021, 'Test Algorithm contest 2021', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2021, 2021, 'Test round 2021', 'Test round 2021', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2022, 'Test Algorithm contest 2022', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2022, 2022, 'Test round 2022', 'Test round 2022', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2023, 'Test Algorithm contest 2023', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2023, 2023, 'Test round 2023', 'Test round 2023', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2024, 'Test Algorithm contest 2024', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2024, 2024, 'Test round 2024', 'Test round 2024', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2025, 'Test Algorithm contest 2025', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2025, 2025, 'Test round 2025', 'Test round 2025', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2026, 'Test Algorithm contest 2026', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2026, 2026, 'Test round 2026', 'Test round 2026', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2027, 'Test Algorithm contest 2027', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2027, 2027, 'Test round 2027', 'Test round 2027', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2028, 'Test Algorithm contest 2028', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2028, 2028, 'Test round 2028', 'Test round 2028', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2029, 'Test Algorithm contest 2029', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2029, 2029, 'Test round 2029', 'Test round 2029', 2, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2030, 'Test Algorithm contest 2030', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2030, 2030, 'Test round 2030', 'Test round 2030', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2031, 'Test Algorithm contest 2031', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2031, 2031, 'Test round 2031', 'Test round 2031', 2, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2032, 'Test Algorithm contest 2032', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2032, 2032, 'Test round 2032', 'Test round 2032', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2033, 'Test Algorithm contest 2033', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2033, 2033, 'Test round 2033', 'Test round 2033', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2034, 'Test Algorithm contest 2034', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2034, 2034, 'Test round 2034', 'Test round 2034', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2035, 'Test Algorithm contest 2035', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2035, 2035, 'Test round 2035', 'Test round 2035', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2036, 'Test Algorithm contest 2036', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2036, 2036, 'Test round 2036', 'Test round 2036', 2, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2037, 'Test Algorithm contest 2037', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2037, 2037, 'Test round 2037', 'Test round 2037', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2038, 'Test Algorithm contest 2038', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2038, 2038, 'Test round 2038', 'Test round 2038', 1, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2039, 'Test Algorithm contest 2039', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2039, 2039, 'Test round 2039', 'Test round 2039', 10, 0, 4017, 'A'); +INSERT INTO contest(contest_id, name, start_date, end_date) VALUES(2040, 'Test Algorithm contest 2040', CURRENT, CURRENT); +INSERT INTO round(round_id, contest_id, name, short_name, round_type_id, failed, calendar_id, status) VALUES(2040, 2040, 'Test round 2040', 'Test round 2040', 1, 0, 4017, 'A'); diff --git a/test/sqls/marathonRegInfo/common_oltp__clean b/test/sqls/marathonRegInfo/common_oltp__clean new file mode 100755 index 000000000..f840911ef --- /dev/null +++ b/test/sqls/marathonRegInfo/common_oltp__clean @@ -0,0 +1,7 @@ +DELETE FROM user_address_xref WHERE user_id = 300003; +DELETE FROM address WHERE address_id = 2001; +DELETE FROM event_registration WHERE event_id = 2001; +DELETE FROM event WHERE event_id = 2001; +DELETE FROM user_role_xref WHERE login_id IN (300002, 300003); +DELETE FROM security_user WHERE login_id IN (300002, 300003); +DELETE FROM user WHERE user_id IN (300001, 300002, 300003); diff --git a/test/sqls/marathonRegInfo/common_oltp__insert_test_data b/test/sqls/marathonRegInfo/common_oltp__insert_test_data new file mode 100755 index 000000000..c3bbee2c0 --- /dev/null +++ b/test/sqls/marathonRegInfo/common_oltp__insert_test_data @@ -0,0 +1,26 @@ +INSERT INTO user(user_id, handle, status) VALUES(300001, 'testUser300001', 'A'); + +INSERT INTO user(user_id, handle, status) VALUES(300002, 'testUser300002', 'U'); +INSERT INTO security_user(login_id, user_id, password, create_user_id) +VALUES(300002, 'testUser300002', '4EjPjy6o+/C+dqNPnxIy9A==', 0); +INSERT INTO user_role_xref(user_role_id, login_id, role_id, create_user_id, security_status_id) +VALUES(2001, 300002, 1000, 132456, 1); + +INSERT INTO user(user_id, handle, status) VALUES(300003, 'testUser300003', 'A'); +INSERT INTO security_user(login_id, user_id, password, create_user_id) +VALUES(300003, 'testUser300003', '4EjPjy6o+/C+dqNPnxIy9A==', 0); +INSERT INTO user_role_xref(user_role_id, login_id, role_id, create_user_id, security_status_id) +VALUES(2002, 300003, 1000, 132456, 1); +INSERT INTO address(address_id, address_type_id, country_code, create_date, modify_date) +VALUES(2001, 2, 192, current, current); +INSERT INTO user_address_xref(user_id, address_id) VALUES(300003, 2001); + +INSERT INTO event(event_id, event_type_id, event_desc, modify_date) VALUES(2001, 1, 'Test Event 2001', current); +INSERT INTO event_registration(event_id, user_id, eligible_ind, notes, create_date, modify_date) +VALUES(2001, 124764, 0, 'test', current, current); +INSERT INTO event_registration(event_id, user_id, eligible_ind, notes, create_date, modify_date) +VALUES(2001, 124766, 1, 'test', current, current); +INSERT INTO event_registration(event_id, user_id, eligible_ind, notes, create_date, modify_date) +VALUES(2001, 300003, 1, 'test', current, current); +INSERT INTO event_registration(event_id, user_id, eligible_ind, notes, create_date, modify_date) +VALUES(2001, 132456, 1, 'test', current, current); diff --git a/test/sqls/marathonRegInfo/informixoltp__clean b/test/sqls/marathonRegInfo/informixoltp__clean new file mode 100755 index 000000000..98dd846cc --- /dev/null +++ b/test/sqls/marathonRegInfo/informixoltp__clean @@ -0,0 +1,19 @@ +DELETE FROM answer WHERE question_id IN (1000, 1001, 1002); +DELETE FROM round_question WHERE round_id = 2001; +DELETE FROM question WHERE question_id IN (1000, 1001, 1002); + +DELETE FROM round_terms WHERE round_id IN (2001, 2006); + +DELETE FROM round_registration WHERE round_id >= 2001; +DELETE FROM round_terms_acceptance WHERE round_id >= 2001; +DELETE FROM algo_rating WHERE coder_id IN (132456); +DELETE FROM long_comp_result WHERE round_id >= 2001; + +DELETE FROM round_event WHERE round_id IN (2001, 2006, 2007); +DELETE FROM round_segment WHERE round_id IN (2001, 2002, 2003, 2004, 2005, 2006, 2007); +DELETE FROM round_component WHERE round_id IN (2004, 2005); +DELETE FROM invite_list WHERE round_id = 2005; +DELETE FROM round WHERE round_id IN (2001, 2002, 2003, 2004, 2005, 2006, 2007); +DELETE FROM team_coder_xref WHERE coder_id IN (132456); + +DELETE FROM contest WHERE contest_id IN (10000, 10001); diff --git a/test/sqls/marathonRegInfo/informixoltp__insert_test_data b/test/sqls/marathonRegInfo/informixoltp__insert_test_data new file mode 100755 index 000000000..0f8190117 --- /dev/null +++ b/test/sqls/marathonRegInfo/informixoltp__insert_test_data @@ -0,0 +1,61 @@ +INSERT INTO contest (contest_id, name, status, group_id) VALUES (10000, 'Marathon Match 90', 'A', -1); +INSERT INTO contest (contest_id, name, status, group_id) VALUES (10001, 'Marathon Match 91', 'A', -1); + +INSERT INTO round(round_id, contest_id, name, status, round_type_id, short_name, invitational, registration_limit) VALUES(2001, 10000, 'Round 2001', 'A', 13, 'Test Round 2001', 0, 10); +INSERT INTO round(round_id, contest_id, name, status, round_type_id, short_name, invitational, registration_limit) VALUES(2002, 1000, 'Test Round 2002', 'A', 13, 'Test Round 2002', 0, 10); +INSERT INTO round(round_id, contest_id, name, status, round_type_id, short_name, invitational, registration_limit) VALUES(2003, 1000, 'Test Round 2003', 'A', 13, 'Test Round 2003', 1, 10); +INSERT INTO round(round_id, contest_id, name, status, round_type_id, short_name, invitational, registration_limit) VALUES(2004, 1000, 'Test Round 2004', 'A', 13, 'Test Round 2004', 0, 10); +INSERT INTO round(round_id, contest_id, name, status, round_type_id, short_name, invitational, registration_limit) VALUES(2005, 1000, 'Test Round 2005', 'A', 13, 'Test Round 2005', 1, 10); +INSERT INTO round(round_id, contest_id, name, status, round_type_id, short_name, invitational, registration_limit) VALUES(2006, 10001, 'Test Round 2006', 'A', 13, 'Test Round 2006', 0, 10); +INSERT INTO round(round_id, contest_id, name, status, round_type_id, short_name, invitational, registration_limit) VALUES(2007, 10001, 'Test Round 2007', 'A', 13, 'Test Round 2007', 0, 10); + +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2001, 1, current - 50 units day, current + 30 units day, 'P'); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2001, 2, current - 50 units day, current + 30 units day, 'P'); + +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2002, 1, current - 50 units day, current - 1 units day, 'P'); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2002, 2, current - 50 units day, current - 1 units day, 'P'); + +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2003, 1, current - 50 units day, current + 30 units day, 'P'); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2003, 2, current - 50 units day, current + 30 units day, 'P'); + +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2004, 1, current - 50 units day, current + 30 units day, 'P'); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2004, 2, current - 50 units day, current + 60 units day, 'P'); + +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2005, 1, current - 50 units day, current + 30 units day, 'P'); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2005, 2, current - 50 units day, current + 60 units day, 'P'); + +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2006, 1, current - 50 units day, current + 30 units day, 'P'); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2006, 2, current - 50 units day, current + 30 units day, 'P'); + +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2007, 1, current - 50 units day, current + 30 units day, 'P'); +INSERT INTO round_segment(round_id, segment_id, start_time, end_time, status) VALUES(2007, 2, current - 50 units day, current + 30 units day, 'P'); + +INSERT INTO round_component(round_id, component_id, division_id) VALUES(2004, 2021, 1); +INSERT INTO round_component(round_id, component_id, division_id) VALUES(2005, 2021, 1); + +INSERT INTO invite_list(coder_id, round_id) VALUES(124772, 2005); + +INSERT INTO round_event(round_id, event_id, event_name, registration_url) VALUES(2001, 2001, 'Test Event 2001', 'https://foo.com'); +INSERT INTO round_event(round_id, event_id, event_name, registration_url) VALUES(2006, 2001, 'Test Event 2006', 'https://foo.com'); +INSERT INTO round_event(round_id, event_id, event_name, registration_url) VALUES(2007, 2001, 'Test Event 2007', 'https://foo.com'); + +INSERT INTO round_registration(round_id, coder_id, timestamp, eligible, team_id) +VALUES(2001, 124766, current, 1, null); +INSERT INTO team_coder_xref(team_id, coder_id, create_date) VALUES(36024, 132456, current); + +INSERT INTO round_terms(round_id) VALUES(2001); +INSERT INTO round_terms(round_id) VALUES(2006); + +INSERT INTO question(question_id, question_text, status_id, question_type_id, question_style_id) VALUES (1000, 'question 1000', 1, 2, 2); +INSERT INTO question(question_id, question_text, status_id, question_type_id, question_style_id) VALUES (1001, 'question 1001', 1, 3, 4); +INSERT INTO question(question_id, question_text, status_id, question_type_id, question_style_id) VALUES (1002, 'question 1002', 1, 2, 1); + +INSERT INTO round_question(round_id, question_id) VALUES (2001, 1000); +INSERT INTO round_question(round_id, question_id) VALUES (2001, 1001); +INSERT INTO round_question(round_id, question_id) VALUES (2001, 1002); + +INSERT INTO answer(answer_id, question_id, answer_text, sort_order, correct) VALUES (1001, 1000, 'answer text 2', 2, 0); +INSERT INTO answer(answer_id, question_id, answer_text, sort_order, correct) VALUES (1002, 1000, 'answer text 1', 1, 1); +INSERT INTO answer(answer_id, question_id, answer_text, sort_order, correct) VALUES (1003, 1000, 'answer text 3', 3, NULL); +INSERT INTO answer(answer_id, question_id, answer_text, sort_order, correct) VALUES (1004, 1002, 'answer text 4', NULL, 0); +INSERT INTO answer(answer_id, question_id, answer_text, sort_order, correct) VALUES (1005, 1002, 'answer text 5', 1, 1); diff --git a/test/sqls/register_member/common_oltp__select_user b/test/sqls/register_member/common_oltp__select_user index df8fdfc56..55d7a415d 100644 --- a/test/sqls/register_member/common_oltp__select_user +++ b/test/sqls/register_member/common_oltp__select_user @@ -1 +1 @@ -user_id,first_name,last_name,handle,status,activation_code,reg_source from user where handle = 'testHandleFoo' \ No newline at end of file +user_id,first_name,last_name,handle,status,activation_code,reg_source,utm_source,utm_medium,utm_campaign from user where handle = 'testHandleFoo' \ No newline at end of file diff --git a/test/sqls/resetPassword/common_oltp__clean b/test/sqls/resetPassword/common_oltp__clean new file mode 100644 index 000000000..39a48c56c --- /dev/null +++ b/test/sqls/resetPassword/common_oltp__clean @@ -0,0 +1,11 @@ +DELETE FROM user_role_xref WHERE login_id BETWEEN 400011 AND 400099; +DELETE FROM user_social_login WHERE user_id BETWEEN 400011 AND 400099; +DELETE FROM user_address_xref WHERE user_id BETWEEN 400011 AND 400099; +DELETE FROM email WHERE user_id BETWEEN 400011 AND 400099; +DELETE FROM security_user WHERE login_id BETWEEN 400011 AND 400099; +DELETE FROM user WHERE user_id BETWEEN 400011 AND 400099; +DELETE FROM informixoltp:coder WHERE coder_id BETWEEN 400011 AND 400099; +DELETE FROM address WHERE address_id BETWEEN 40000001 AND 40000099; + + + diff --git a/test/sqls/resetPassword/common_oltp__insert_test_data b/test/sqls/resetPassword/common_oltp__insert_test_data new file mode 100644 index 000000000..5f6f51dd2 --- /dev/null +++ b/test/sqls/resetPassword/common_oltp__insert_test_data @@ -0,0 +1,154 @@ +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400011, 'normal_user_11', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400011, 'normal_user_11', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400011); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400011, 400011, 1, 'normal_user_11@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000001, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id,address_id) VALUES (400011, 40000001); + + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400012, 'normal_user_12', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400012, 'normal_user_12', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400012); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400012, 400012, 1, 'normal_user_12@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000002, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400012, 40000002); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name) + VALUES ('fb40002', 400012, 1, 'user2'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400013, 'normal_user_13', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400013, 'normal_user_13', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400013); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400013, 400013, 1, 'normal_user_13@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000003, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400013, 40000003); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400014, 'normal_user_14', 'U', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400014, 'normal_user_14', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400014); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400014, 400014, 1, 'normal_user_14@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000004, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400014, 40000004); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400015, 'normal_user_15', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400015, 'normal_user_15', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400015); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400015, 400015, 1, 'normal_user_15@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000005, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id,address_id) VALUES (400015, 40000005); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400016, 'admin_user_16', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400016, 'admin_user_16', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400016); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400016, 400016, 1, 'admin_user_16@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000006, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id,address_id) VALUES (400016, 40000006); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name) + VALUES ('fb40006', 400016, 1, 'admin6'); +INSERT INTO user_role_xref (user_role_id, login_id, role_id, create_user_id, security_status_id) VALUES (400016, 400016, 2087, 400016, 1); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400017, 'normal_user_17', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400017, 'normal_user_17', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400017); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400017, 400017, 1, 'normal_user_17@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000007, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400017, 40000007); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name) + VALUES ('fb40007', 400017, 1, 'common_handle'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400018, 'common_handle', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400018, 'common_handle', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400018); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400018, 400018, 1, 'normal_user_18@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000008, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400018, 40000008); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name) + VALUES ('gg40008', 400018, 2, 'user8'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400019, 'normal_user_19', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400019, 'normal_user_19', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400019); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400019, 400019, 1, 'normal_user_19@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000009, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400019, 40000009); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name) + VALUES ('fb40009', 400019, 1, 'common_handle2'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400020, 'common_handle2', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400020, 'common_handle2', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400020); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400020, 400020, 1, 'normal_user_20@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000010, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400020, 40000010); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400021, 'normal_user_21', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400021, 'normal_user_21', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400021); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400021, 400021, 1, 'normal_user_21@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000011, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400021, 40000011); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name, social_email) + VALUES ('tw40010', 400021, 3, 'user21', 'social.email21@test.com'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400022, 'normal_user_22', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400022, 'normal_user_22', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400022); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400022, 400022, 1, 'normal_user_22@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000012, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400022, 40000012); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name, social_email) + VALUES ('fb40011', 400022, 1, 'user22', 'common_email@test.com'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400023, 'normal_user_23', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400023, 'normal_user_23', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400023); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400023, 400023, 1, 'common_email@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000013, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400023, 40000013); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name) + VALUES ('gg40012', 400023, 2, 'user23'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400024, 'normal_user_24', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400024, 'normal_user_24', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400024); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400024, 400024, 1, 'normal_user_24@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000014, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400024, 40000014); +INSERT INTO user_social_login (social_user_id, user_id, social_login_provider_id, social_user_name, social_email) + VALUES ('fb40013', 400024, 1, 'user24', 'common_email2@test.com'); + +INSERT INTO user (user_id, handle, status, timezone_id) VALUES (400025, 'normal_user_25', 'A', 143); +INSERT INTO security_user (login_id, user_id, password, create_user_id) VALUES (400025, 'normal_user_25', '4EjPjy6o+/C+dqNPnxIy9A==', NULL); +INSERT INTO informixoltp:coder (coder_id) VALUES (400025); +INSERT INTO email (user_id, email_id, email_type_id, address, create_date, modify_date, primary_ind, status_id) + VALUES (400025, 400025, 1, 'common_email2@test.com', CURRENT, CURRENT, 1, 1); +INSERT INTO address(address_id, address_type_id, address1, address2, city, state_code, zip, country_code, create_date, modify_date, address3, province) + VALUES (40000015, 2, 'address1', NULL, 'city', 'ME', '04043', '840', '2008-08-01 16:37:48.000', '2008-08-01 16:37:48.000', NULL, NULL); +INSERT INTO user_address_xref(user_id, address_id) VALUES (400025, 40000015); diff --git a/test/test.applyDevelopReviewOpportunity.js b/test/test.applyDevelopReviewOpportunity.js new file mode 100644 index 000000000..dbbd7d3ca --- /dev/null +++ b/test/test.applyDevelopReviewOpportunity.js @@ -0,0 +1,419 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author Ghost_141 + */ +'use strict'; +/*global describe, it, before, beforeEach, after, afterEach */ +/*jslint node: true, stupid: true, unparam: true */ + +/** + * Module dependencies. + */ +var _ = require('underscore'); +var request = require('supertest'); +var assert = require('chai').assert; +var async = require('async'); +var S = require('string'); + +var testHelper = require('./helpers/testHelper'); +var SQL_DIR = __dirname + '/sqls/applyDevelopReviewOpportunity/'; +var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080'; + +describe('Get Software Review Opportunity Details API', function () { + this.timeout(180000); // The api with testing remote db could be quit slow + + var msgObj = require('../test/test_files/expected_apply_software_review_opportunities_response_message'), + member1 = testHelper.generateAuthHeader({ sub: 'ad|132457' }), + member2 = testHelper.generateAuthHeader({ sub: 'ad|132458' }); + + /** + * Clear database + * @param {Function} done the callback + */ + function clearDb(done) { + async.waterfall([ + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'common_oltp__clean', 'common_oltp', cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'tcs_catalog__clean', 'tcs_catalog', cb); + } + ], done); + } + + /** + * This function is run before all tests. + * Generate tests data. + * @param {Function} done the callback + */ + before(function (done) { + async.waterfall([ + clearDb, + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'tcs_catalog__insert_test_data', 'tcs_catalog', cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'common_oltp__insert_test_data', 'common_oltp', cb); + } + ], done); + }); + + /** + * This function is run after all tests. + * Clean up all data. + * @param {Function} done the callback + */ + after(function (done) { + clearDb(done); + }); + + /** + * create a http request and test it. + * @param {String} url - the request url. + * @param {Number} expectStatus - the expected response status code. + * @param {Object} authHeader - the auth header. + * @param {Object} postData - the data post to api. + * @param {Function} cb - the call back function. + */ + function createGetRequest(url, expectStatus, authHeader, postData, cb) { + var req = request(API_ENDPOINT) + .post('/v2/develop/reviewOpportunities/' + url + '/apply') + .set('Accept', 'application/json') + .expect('Content-Type', /json/); + if (authHeader) { + req.set('Authorization', authHeader); + } + req.expect(expectStatus) + .send(postData) + .end(cb); + } + + /** + * assert the bad response. + * @param {String} url - the request url + * @param {Number} expectStatus - the expect status. + * @param {String} errorMessage - the expected error message. + * @param {Object} authHeader - the request auth header. + * @param {Object} postData - the data post to api. + * @param {Function} cb - the callback function. + */ + function assertBadResponse(url, expectStatus, errorMessage, authHeader, postData, cb) { + createGetRequest(url, expectStatus, authHeader, postData, function (err, result) { + if (!err) { + assert.equal(result.body.error.details, errorMessage, 'invalid error message'); + } else { + cb(err); + return; + } + cb(); + }); + } + + /** + * Test when caller is anonymous. + */ + it('should return unauthorized Error. The caller is anonymous.', function (done) { + assertBadResponse('2001', 401, msgObj.unauthorized, null, null, done); + }); + + + /** + * Test when challengeId is not number. + */ + it('should return bad request. The challengeId is not number.', function (done) { + assertBadResponse('abc', 400, msgObj.challengeId.notNumber, + member1, null, done); + }); + + /** + * Test when challengeId is not integer. + */ + it('should return bad request. The challengeId is not integer.', function (done) { + assertBadResponse('1.2345', 400, msgObj.challengeId.notInteger, + member1, null, done); + }); + + /** + * Test when challengeId is not positive. + */ + it('should return bad request. The challengeId is not positive.', function (done) { + assertBadResponse('-1', 400, msgObj.challengeId.notPositive, + member1, null, done); + }); + + /** + * Test when challengeId is zero. + */ + it('should return bad request. The challengeId is zero.', function (done) { + assertBadResponse('0', 400, msgObj.challengeId.notPositive, + member1, null, done); + }); + + /** + * Test when challengeId is too big. + */ + it('should return bad request. The challengeId is too big.', function (done) { + assertBadResponse('2147483648', 400, msgObj.challengeId.tooBig, + member1, null, done); + }); + + /** + * Test when reviewApplicationRoleId is invalid. + */ + it('should return bad Request. The reviewApplicationRoleId is invalid', function (done) { + assertBadResponse('2001', 400, msgObj.invalidReviewApplicationRole, member1, { + reviewApplicationRoleId: 10 + }, done); + }); + + /** + * Test when challenge is not existed. + */ + it('should return bad Request. The challenge is not existed.', function (done) { + assertBadResponse('8001', 400, msgObj.invalidChallenge, member1, null, done); + }); + + /** + * Test when challenge is existed but don't have any review opportunities. + */ + it('should return bad Request. The challenge don\'t have any review opportunities.', function (done) { + assertBadResponse('2002', 400, msgObj.invalidChallenge, member1, null, done); + }); + + /** + * Test when challenge review registration is not open. + */ + it('should return bad Request. The challenge review registration is not open.', function (done) { + assertBadResponse('2003', 400, msgObj.invalidChallenge, member1, null, done); + }); + + /** + * Test when requested review application role id is not belong to this challenge. + */ + it('should return bad Request. The requested review application role id is not belong to this challenge.', function (done) { + assertBadResponse('2001', 400, msgObj.invalidReviewApplicationId, member1, { reviewApplicationRoleId: 3 }, done); + }); + + /** + * Test the caller is not a reviewer for this kind of challenge. + */ + it('should return bad Request. The caller is not reviewer for this kind of challenge.', function (done) { + assertBadResponse('2004', 403, msgObj.notReviewer, member2, { reviewApplicationRoleId: 1 }, done); + }); + + /** + * Test when caller is not allowed to access this challenge. + */ + it('should return bad Request. The caller is not allowed to access this challenge.', function (done) { + assertBadResponse('2005', 403, msgObj.forbidden, member1, null, done); + }); + + /** + * Test when caller has already been as a reviewer. + */ + it('should return bad Request. The caller has already been assigned as a reviewer.', function (done) { + async.waterfall([ + function (cb) { + testHelper.runSqlQuery('INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) VALUES(2015, 2, 2001, 132456, current, 132456, current); ' + + 'INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date)VALUES(2015, 1, "132457", 132456, current, 132456, current); ' + + 'INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) VALUES(2016, 4, 2001, 132456, current, 132456, current); ' + + 'INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date)VALUES(2016, 1, "132457", 132456, current, 132456, current); ' + + 'INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) VALUES(2017, 8, 2001, 132456, current, 132456, current); ' + + 'INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date)VALUES(2017, 1, "132457", 132456, current, 132456, current); ' + + 'INSERT INTO resource(resource_id, resource_role_id, project_id, create_user, create_date, modify_user, modify_date) VALUES(2018, 9, 2001, 132456, current, 132456, current); ' + + 'INSERT INTO resource_info(resource_id, resource_info_type_id, value, create_user, create_date, modify_user, modify_date)VALUES(2018, 1, "132457", 132456, current, 132456, current);', 'tcs_catalog', cb); + }, + function (cb) { + assertBadResponse('2001', 400, msgObj.alreadyAReviewer, member1, { reviewApplicationRoleId: 1 }, cb); + }, + function (cb) { + testHelper.runSqlQueries(['DELETE FROM resource_info WHERE resource_id >= 2015;', 'DELETE FROM resource WHERE resource_id >= 2015'], 'tcs_catalog', cb); + } + ], done); + }); + + /** + * Test when challenge don't have open positions. + */ + it('should return bad Request. The challenge don\'t have any open positions.', function (done) { + assertBadResponse('2006', 400, msgObj.noOpenPositions, member1, { reviewApplicationRoleId: 1 }, done); + }); + + /** + * Test when there is no positions for applying primary reviewer. + */ + it('should return bad Request. There is no open positions for applying role.', function (done) { + assertBadResponse('2007', 400, msgObj.noPositionsForPrimaryReviewer, member2, { reviewApplicationRoleId: 1 }, done); + }); + + /** + * Test when challenge don't have open positions for applying secondary reviewer. + */ + it('should return bad Request. The challenge don\'t have open secondary reviewer positions.', function (done) { + assertBadResponse('2009', 400, msgObj.noPositionsForSecondaryReviewer, member1, { reviewApplicationRoleId: 2 }, done); + }); + + /** + * Test when there is still terms of use not agreed. + */ + it('should return bad Request. The terms of use are not all agreed.', function (done) { + assertBadResponse('2001', 403, msgObj.notAgreedTerms, member2, { reviewApplicationRoleId: 2 }, done); + }); + + /** + * Test when the register is success and the assignment date is passed. + */ + it('should return success results. The review application is created. The assignment date is passed.', function (done) { + async.waterfall([ + function (cb) { + createGetRequest('2001', 200, member1, { reviewApplicationRoleId: 1 }, function (err, result) { + cb(err, result); + }); + }, + function (result, cb) { + assert.equal(result.body.message, msgObj.success.afterAssignment, 'invalid response'); + + testHelper.runSqlSelectQuery('* FROM review_application WHERE review_auction_id = 2001;', 'tcs_catalog', cb); + }, + function (result, cb) { + assert.isTrue(result[0].review_application_id >= 3000000, 'invalid review application id'); + assert.isTrue(result[0].review_application_role_id === 1, 'invalid review application role id'); + assert.isTrue(result[0].review_application_status_id === 1, 'invalid review application status id'); + cb(); + } + ], done); + }); + + /** + * Test when register is success and the assignment is not passed. + */ + it('should return success results. The review application is created. The assignment is not passed.', function (done) { + async.waterfall([ + function (cb) { + createGetRequest('2008', 200, member1, { reviewApplicationRoleId: 1 }, function (err, result) { + cb(err, result); + }); + }, + function (result, cb) { + assert.isTrue(new S(result.body.message).startsWith(msgObj.success.beforeAssignmentPrefix), 'invalid prefix'); + assert.isTrue(new S(result.body.message).endsWith(msgObj.success.beforeAssignmentSuffix), 'invalid suffix'); + + testHelper.runSqlSelectQuery('* FROM review_application WHERE review_auction_id = 2008;', 'tcs_catalog', cb); + }, + function (result, cb) { + assert.isTrue(result[0].review_application_id >= 3000000, 'invalid review application id'); + assert.isTrue(result[0].review_application_role_id === 1, 'invalid review application role id'); + assert.isTrue(result[0].review_application_status_id === 1, 'invalid review application status id'); + cb(); + } + ], done); + }); + + /** + * Test when register cancelled all his registration. + */ + it('should return success results. The review application is cancelled.', function (done) { + async.waterfall([ + function (cb) { + createGetRequest('2001', 200, member1, null, function (err, result) { + cb(err, result); + }); + }, + function (result, cb) { + assert.equal(result.body.message, msgObj.success.cancelled, 'invalid response'); + + testHelper.runSqlSelectQuery(' * FROM review_application WHERE review_auction_id = 2001;', 'tcs_catalog', cb); + }, + function (result, cb) { + assert.isTrue(result[0].review_application_role_id === 1, 'invalid review application role id ' + result[0].review_application_role_id); + assert.isTrue(result[0].review_application_status_id === 2, 'invalid review application status id ' + result[0].review_application_status_id); + cb(); + } + ], done); + }); + + /** + * Test when caller apply the primary reviewer first and then cancel it and apply the secondary reviewer. + */ + it('should return success results. The caller apply the primary reviewer before and cancel it and apply secondary reviewer.', function (done) { + async.waterfall([ + function (cb) { + createGetRequest('2001', 200, member1, { reviewApplicationRoleId: 1 }, function (err) { + cb(err); + }); + }, + function (cb) { + testHelper.runSqlSelectQuery(' * FROM review_application WHERE review_auction_id = 2001 AND review_application_status_id = 1;', 'tcs_catalog', cb); + }, + function (result, cb) { + assert.isTrue(result[0].review_application_id >= 3000000); + assert.isTrue(result[0].review_application_role_id === 1); + cb(); + }, + function (cb) { + createGetRequest('2001', 200, member1, { reviewApplicationRoleId: 2 }, function (err) { + cb(err); + }); + }, + function (cb) { + testHelper.runSqlSelectQuery(' * FROM review_application WHERE review_auction_id = 2001 AND ' + + 'review_application_role_id = 1;', 'tcs_catalog', cb); + }, + function (result, cb) { + result.forEach(function (item) { + assert.isTrue(item.review_application_status_id === 2); + }); + cb(); + }, + function (cb) { + testHelper.runSqlSelectQuery(' * FROM review_application WHERE review_auction_id = 2001 AND ' + + 'review_application_role_id = 2;', 'tcs_catalog', cb); + }, + function (result, cb) { + result.forEach(function (item) { + assert.isTrue(item.review_application_status_id === 1); + }); + cb(); + } + ], done); + }); + + /** + * Test when caller apply the primary reviewer first and apply the primary reviewer and secondary reviewer + */ + it('should return success results. The caller apply the primary reviewer first and apply the primary reviewer and secondary reviewer.', function (done) { + async.waterfall([ + function (cb) { + testHelper.runSqlQueries(['DELETE FROM resource_info WHERE resource_id >= 2001;', 'DELETE FROM resource WHERE resource_id >= 2001;'], 'tcs_catalog', + function (err) { + cb(err); + }); + }, + function (cb) { + createGetRequest('2001', 200, member1, { reviewApplicationRoleId: 1 }, function (err) { + cb(err); + }); + }, + function (cb) { + createGetRequest('2001', 200, member1, { reviewApplicationRoleId: [1, 2] }, function (err) { + cb(err); + }); + }, + function (cb) { + testHelper.runSqlSelectQuery(' * FROM review_application WHERE review_auction_id = 2001 AND ' + + 'review_application_status_id = 1 AND user_id = 132457 ORDER BY review_application_role_id ASC;', 'tcs_catalog', cb); + }, + function (result, cb) { + assert.equal(result.length, 2, 'invalid results length'); + assert.equal(result[0].review_application_role_id, 1, 'invalid response'); + assert.equal(result[1].review_application_role_id, 2, 'invalid response'); + cb(); + } + ], done); + }); + + + +}); 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.challengeUnregistration.js b/test/test.challengeUnregistration.js new file mode 100755 index 000000000..85f776350 --- /dev/null +++ b/test/test.challengeUnregistration.js @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author bugbuka + */ +"use strict"; +/*global describe, it, before, beforeEach, after, afterEach */ +/*jslint node: true, stupid: true, unparam: true */ + +/** + * Module dependencies. + */ +var fs = require('fs'); +var supertest = require('supertest'); +var assert = require('chai').assert; +var async = require('async'); +var _ = require('underscore'); +var testHelper = require('./helpers/testHelper'); +var SQL_DIR = __dirname + "/sqls/challengeUnregistration/"; +var SQL_DIR2 = "sqls/challengeUnregistration/"; +var TEST_FILE_DIR = "test/test_files/"; + +var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080'; + +var grantForumAccess = require('../config').config.general.grantForumAccess; +/** + * Objects and values required for generating the OAuth token + */ +var CLIENT_ID = require('../config').config.general.oauthClientId; +var SECRET = require('../config').config.general.oauthClientSecret; +var jwt = require('jsonwebtoken'); + +describe('Challenge Unregistration API', function () { + this.timeout(120000); // The api with testing remote db could be quit slow + + /** + * Users that we have setup. + */ + var user11 = 'facebook|fb400011', + user12 = 'facebook|fb400012'; + + /** + * Return the authentication header to be used for the given user. + * @param {Object} user the user to authenticate + */ + function getAuthHeader(user) { + var authHeader = "Bearer " + jwt.sign({sub: user}, SECRET, {expiresInMinutes: 1000, audience: CLIENT_ID}); + return authHeader; + } + + /** + * Clear database + * @param {Function} done the callback + */ + function clearDb(done) { + async.series([ + function (cb) { + if (grantForumAccess !== true) { + cb(); + return; + } + testHelper.runSqlFile(SQL_DIR + "jive__clean", "jive", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "tcs_catalog__clean", "tcs_catalog", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "common_oltp__clean", "common_oltp", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "informixoltp__clean", "informixoltp", cb); + } + ], done); + } + + /** + * This function is run before all tests. + * Generate tests data. + * @param {Function} done the callback + */ + before(function (done) { + async.series([ + clearDb, + function (cb) { + if (grantForumAccess !== true) { + cb(); + return; + } + testHelper.runSqlFile(SQL_DIR + "jive__insert_test_data", "jive", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "common_oltp__insert_test_data", "common_oltp", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "tcs_catalog__insert_test_data", "tcs_catalog", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "informixoltp__insert_test_data", "informixoltp", cb); + } + ], done); + }); + /** + * This function is run after all tests. + * Clean up all data. + * @param {Function} done the callback + */ + after(function (done) { + clearDb(done); + }); + + //validate against a table + function validateTable(sqlfile, done) { + console.log("Now validate based on sqlfile: " + sqlfile); + async.waterfall([ + function (callback) { + testHelper.runSqlFromJSON(sqlfile, true, callback); + }, + function (result, callback) { + console.log('The query result:' + JSON.stringify(result)); + assert.ok(result.length === 0, 'result is empty'); + console.log('matched'); + callback(null, null); + } + ], done); + } + + //validateDatabase for test successInput + function validateDatabaseForDevelop(done) { + async.series([ + function (callback) { + validateTable( + SQL_DIR2 + "tcs_catalog__select_component_inquiry.json", + callback + ); + }, + function (callback) { + validateTable( + SQL_DIR2 + "tcs_catalog__select_project_result.json", + callback + ); + }, + function (callback) { + validateTable( + SQL_DIR2 + "tcs_catalog__select_software_challenge_resource.json", + callback + ); + }, + function (callback) { + validateTable( + SQL_DIR2 + "tcs_catalog__select_software_challenge_resource_info.json", + callback + ); + }, + function (callback) { + validateTable( + SQL_DIR2 + "tcs_catalog__select_software_challenge_component_inquiry.json", + callback + ); + }, + function (callback) { + if (grantForumAccess !== true) { + callback(); + return; + } + + validateTable( + SQL_DIR2 + "jive__select_jiveuserperm.json", + callback + ); + } + ], done); + } + + //validateDatabase for test successInput + function validateDatabaseForDesign(done) { + async.series([ + function (callback) { + validateTable( + SQL_DIR2 + "tcs_catalog__select_studio_challenge_resource.json", + callback + ); + }, + function (callback) { + validateTable( + SQL_DIR2 + "tcs_catalog__select_studio_challenge_resource_info.json", + callback + ); + } + ], done); + } + + // Check if the data are in expected structure and data + it('Unregister software challenge should success', function (done) { + supertest(API_ENDPOINT) + .post("/v2/challenges/40000001/unregister") + .set('Accept', 'application/json') + .set('Authorization', getAuthHeader(user11)) + .expect('Content-Type', /json/) + .expect(200) + .end(function (err, result) { + if (err) { + done(err); + return; + } + console.log('Registration completed. Now verify the database is the same as predicted data'); + validateDatabaseForDevelop(done); + }); + }); + + // Unreigster again the same user, the same challenge as above, should fail. + it('Unregister again should fail', function (done) { + supertest(API_ENDPOINT) + .post("/v2/challenges/40000001/unregister") + .set('Accept', 'application/json') + .set('Authorization', getAuthHeader(user11)) + .expect('Content-Type', /json/) + .expect(403, done); + }); + + + /// Check if the data are in expected structure and data + it('Unregister studio challenge should success', function (done) { + supertest(API_ENDPOINT) + .post("/v2/challenges/40000002/unregister") + .set('Accept', 'application/json') + .set('Authorization', getAuthHeader(user11)) + .expect('Content-Type', /json/) + .expect(200) + .end(function (err, result) { + if (err) { + done(err); + return; + } + validateDatabaseForDesign(done); + }); + }); + + // Check if the data are in expected structure and data + // It's a copilot posting challenge. + it('User unregister a copilot posting challenge', function (done) { + supertest(API_ENDPOINT) + .post("/v2/challenges/40000003/unregister") + .set('Accept', 'application/json') + .set('Authorization', getAuthHeader(user11)) + .expect('Content-Type', /json/) + .expect(200) + .end(function (err, result) { + if (err) { + done(err); + return; + } + console.log('Registration completed. Now verify the database is the same as predicted data'); + validateDatabaseForDevelop(done); + }); + }); + + // negative challengeId number. + it('negative challenge number', function (done) { + supertest(API_ENDPOINT) + .post("/v2/challenges/-40000002/unregister") + .set('Accept', 'application/json') + .set('Authorization', getAuthHeader(user12)) + .expect('Content-Type', /json/) + .expect(400, done); + }); + + // the challengeId param is not a number. + it('Challenge is NOT a number', function (done) { + supertest(API_ENDPOINT) + .post("/v2/challenges/NAN/unregister") + .set('Accept', 'application/json') + .set('Authorization', getAuthHeader(user12)) + .expect('Content-Type', /json/) + .expect(400, done); + }); + + // the challengeId param exceed MAX_INT. + it('Challenge number exceed MAX_INT', function (done) { + supertest(API_ENDPOINT) + .post("/v2/challenges/214748364700/unregister") + .set('Accept', 'application/json') + .set('Authorization', getAuthHeader(user12)) + .expect('Content-Type', /json/) + .expect(400, done); + }); +}); \ No newline at end of file diff --git a/test/test.docusignCallback.js b/test/test.docusignCallback.js new file mode 100644 index 000000000..c1a803e97 --- /dev/null +++ b/test/test.docusignCallback.js @@ -0,0 +1,251 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author kurtrips + */ +"use strict"; +/*global describe, it, before, beforeEach, after, afterEach */ +/*jslint node: true, vars: true, unparam: true */ + +/** + * Module dependencies. + */ +var request = require('supertest'); +var assert = require('chai').assert; +var async = require("async"); +var _ = require("underscore"); +var config = require("../config").config; + +var testHelper = require('./helpers/testHelper'); +var SQL_DIR = __dirname + "/sqls/docusign/callback/"; +var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080'; + +describe('Test Docusign Callback Action', function () { + + /** + * Creates a Request object using the given URL. + * Sets the expected response code using the expectedStatusCode parameter + * @param {String} url the url to connect + * @param {Number} expectedStatusCode the expected status code of the response + */ + function getRequest(url, expectedStatusCode) { + var req = request(API_ENDPOINT) + .post(url) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(expectedStatusCode); + return req; + } + + + this.timeout(120000); // The api with testing remote db could be quit slow + + /** + * Clear database + * @param {Function} done the callback + */ + function clearDb(done) { + async.waterfall([ + function (cb) { + testHelper.runSqlFile(SQL_DIR + "informixoltp__clean", "informixoltp", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "common_oltp__clean", "common_oltp", cb); + } + ], done); + } + + /** + * This function is run before all tests. + * Generate tests data. + * @param {Function} done the callback + */ + before(function (done) { + async.waterfall([ + clearDb, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "common_oltp__insert_test_data", "common_oltp", cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "informixoltp__insert_test_data", "informixoltp", cb); + } + ], done); + }); + + /** + * This function is run after all tests. + * @param {Function} done the callback + */ + after(function (done) { + clearDb(done); + }); + + /** + * Checks that the response has the correct message + * @param err the error (if any) in the response + * @param resp the response + * @param message the expected message + * @param done the callback to call when we are done + */ + function assertMessage(err, resp, message, done) { + if (err) { + done(err); + return; + } + assert.equal(resp.body.message, message); + done(); + } + + var reqBody = { + connectKey: 'ABCDED-12435-EDFADSEC', + envelopeStatus: 'Completed', + envelopeId: '9E045DB0-B50F-11E3-A5E2-0800200C9A66', + tabs: [ + { + "tabLabel": "Signature 1", + "tabValue": "" + }, + { + "tabLabel": "Address", + "tabValue": "123 Aloo" + }, + { + "tabLabel": "Handle", + "tabValue": "Hung" + } + ] + }; + + /** + * Test docusignCallback when connectKey is not the same as in config + * should return 404 + */ + it('should return 404 error when connectKey is not the same as in config', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 404); + + var body = _.clone(reqBody); + body.connectKey = 'ABCDED-56789-EDFADSEC'; + req.send(body) + .end(function (err, resp) { + assertMessage(err, resp, 'Connect Key is missing or invalid.', done); + }); + }); + + /** + * Test docusignCallback when envelopeStatus is not Complete + * should return 200 after simply logging + */ + it('should return 200 when envelopeStatus is not Complete', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 200); + var body = _.clone(reqBody); + body.envelopeStatus = 'Declined'; + req.send(body).end(function (err, resp) { + //The is_completed of the envelope in DB must still be same + testHelper.runSqlSelectQuery("* from docusign_envelope where docusign_envelope_id = '" + body.envelopeId + "'", "informixoltp", function (err, result) { + assert.equal(result[0].is_completed, 0, 'The is_completed of the envelope in DB must still be same'); + done(); + }); + }); + }); + + /** + * Test docusignCallback when envelopeStatus is empty + * should return 200 after simply logging + */ + it('should return 200 when envelopeStatus is emoty', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 200); + var body = _.clone(reqBody); + body.envelopeStatus = ' '; + req.send(body).end(function (err, resp) { + //The is_completed of the envelope in DB must still be same + testHelper.runSqlSelectQuery("* from docusign_envelope where docusign_envelope_id = '" + body.envelopeId + "'", "informixoltp", function (err, result) { + assert.equal(result[0].is_completed, 0, 'The is_completed of the envelope in DB must still be same'); + done(); + }); + }); + }); + + /** + * Test docusignCallback when envelope with given id is not found + * should return 200 after simply logging + */ + it('should return 200 when envelope with given id is not found', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 200); + var body = _.clone(reqBody); + body.envelopeId = '9E045DB0-B50F-11E3-A5E2-0800200C9A67'; + req.send(body).end(done); + }); + + /** + * Test docusignCallback when envelope with given id is found but the template id is unknown + * should return 200 after setting the is_completed but no handlers will be called + */ + it('should return 200 when envelope with given id is found but the template id is unknown', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 200); + var body = _.clone(reqBody); + body.envelopeId = '32A09D40-B51E-11E3-A5E2-0800200C9A66'; + req.send(body).end(function (err, resp) { + //The is_completed of the envelope in DB must be set to 1 + testHelper.runSqlSelectQuery("* from docusign_envelope where docusign_envelope_id = '" + body.envelopeId + "'", "informixoltp", function (err, result) { + assert.equal(result[0].is_completed, 1, 'The is_completed of the envelope in DB must be set to 1'); + done(); + }); + }); + }); + + /** + * Test docusignCallback when user has a ban for terms of use + * should return 200. The terms of use must not be inserted + */ + it('should return 200 with user has a ban for terms of use', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 200); + var body = _.clone(reqBody); + body.envelopeId = '4E0E0DB0-B528-11E3-A5E2-0800200C9A66'; + req.send(body).end(function (err, resp) { + //The terms of use must not be inserted for user + testHelper.runSqlSelectQuery("* from user_terms_of_use_xref where user_id = 124772 and terms_of_use_id = 20753", "common_oltp", function (err, result) { + assert.equal(result.length, 0, 'The terms of use must not be inserted for user.'); + done(); + }); + }); + }); + + /** + * Test docusignCallback when user already has terms of use + * should return 200. The terms of use must not be inserted again + */ + it('should return 200 when user already has terms of use', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 200); + var body = _.clone(reqBody); + body.envelopeId = 'AD6212F0-B525-11E3-A5E2-0800200C9A66'; + req.send(body).end(function (err, resp) { + //The terms of use must already exists and must not be inserted again + testHelper.runSqlSelectQuery("* from user_terms_of_use_xref where user_id = 132456 and terms_of_use_id = 20753", "common_oltp", function (err, result) { + assert.equal(result.length, 1, 'The terms of use must already exist for user.'); + assert.equal(result[0].modify_date, '2013-12-12T00:00:00.000Z', 'The modified date must remain the same.'); + done(); + }); + }); + }); + + /** + * Test docusignCallback for success + * should return 200. The is_completed must be set in docusign_envelope and entry must be inserted in user_terms_of_use_xref + */ + it('should return 200 for success', function (done) { + var req = getRequest('/v2/terms/docusignCallback', 200); + req.send(reqBody).end(function (err, resp) { + testHelper.runSqlSelectQuery("* from user_terms_of_use_xref where user_id = 124764 and terms_of_use_id = 20753", + "common_oltp", function (err, result) { + assert.equal(result.length, 1, 'The terms of use must now exist for user.'); + + testHelper.runSqlSelectQuery("* from docusign_envelope where docusign_envelope_id = '" + reqBody.envelopeId + "'", + "informixoltp", function (err, result) { + assert.equal(result[0].is_completed, 1, 'The is_completed of the envelope in DB must be set to 1'); + done(); + }); + }); + }); + }); +}); diff --git a/test/test.docusignRecipientViewUrl.js b/test/test.docusignRecipientViewUrl.js index de5931d1c..21261952c 100644 --- a/test/test.docusignRecipientViewUrl.js +++ b/test/test.docusignRecipientViewUrl.js @@ -198,25 +198,6 @@ describe('Test Docusign Get Recipient View Url', function () { }); }); - /** - * Test getDocumentViewURL when login to Docusign fails - * should return 500 - */ - it('should return 500 error when login to Docusign fails', function (done) { - var correctPassword = config.docusign.password; - config.docusign.password = 'wrong_password'; - var req = getRequest('/v2/terms/docusign/viewURL', user124764, 500); - - req.send({ templateId: config.docusign.affidavitTemplateId}) - .end(function (err, resp) { - assertError(err, resp, 'Login to DocuSign server failed.', function () { - //make sure we restore the correct password for further tests - config.docusign.password = correctPassword; - done(); - }); - }); - }); - /** * Test getDocumentViewURL when user passes non-existent template id * should return 404 @@ -264,25 +245,6 @@ describe('Test Docusign Get Recipient View Url', function () { ], done); }); - /** - * Test getDocumentViewURL when requesting recipient view fails - * should return 500 - */ - it('should return 500 error when requesting recipient view fails', function (done) { - var roleName = config.docusign.roleName; - config.docusign.roleName = ''; - var req = getRequest('/v2/terms/docusign/viewURL', user124764, 500); - - req.send({ templateId: config.docusign.affidavitTemplateId}) - .end(function (err, resp) { - assertError(err, resp, 'Requesting recipient view failed.', function () { - //make sure we restore the correct roleName for further tests - config.docusign.roleName = roleName; - done(); - }); - }); - }); - /** * Test getDocumentViewURL for success using W-9 template * should return 200 @@ -338,18 +300,17 @@ describe('Test Docusign Get Recipient View Url', function () { /** * Test getDocumentViewURL for success using affidavit template * Tests when the envelope_id already exists for given user and template, in DB (because of previous test) - * A new record must not be created again in DB. + * A new record must be created again in DB. * should return 200 */ - it('should return 200 for success when eneveope info already exists in DB', function (done) { + it('should return 200 for success when envelope info already exists in DB', function (done) { var req = getRequest('/v2/terms/docusign/viewURL', user124764, 200); req.send({ templateId: config.docusign.affidavitTemplateId }) .end(function (err, resp) { testHelper.runSqlSelectQuery("* from docusign_envelope where user_id = 124764 and docusign_template_id = '" + config.docusign.affidavitTemplateId + "'", "informixoltp", function (err, result) { - assert.equal(result.length, 1, 'A new record must NOT be created in docusign_envelope table. Record count must still be 1.'); - assert.equal(result[0].docusign_envelope_id, resp.body.envelopeId, 'The same envelopeId must be used.'); + assert.equal(result.length, 2, 'A new record must be created in docusign_envelope table. Record count must be 2 now.'); done(); }); }); diff --git a/test/test.getChallengesRSS.js b/test/test.getChallengesRSS.js new file mode 100644 index 000000000..79d0c585a --- /dev/null +++ b/test/test.getChallengesRSS.js @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author Ghost_141 + */ +'use strict'; +/*global describe, it, before, beforeEach, after, afterEach */ +/*jslint node: true, stupid: true, unparam: true */ + +/** + * Module dependencies. + */ +var fs = require('fs'); +var _ = require('underscore'); +var request = require('supertest'); +var assert = require('chai').assert; +var async = require('async'); + +var testHelper = require('./helpers/testHelper'); +var SQL_DIR = __dirname + '/sqls/getChallengesRSS/'; +var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080'; + +describe('Get Challenges RSS API', function () { + this.timeout(180000); // The api with testing remote db could be quit slow + + var errorObject = require('../test/test_files/expected_get_challenges_rss_error_message'); + + /** + * Clear database + * @param {Function} done the callback + */ + function clearDb(done) { + async.waterfall([ + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'informixoltp__clean', 'informixoltp', cb); + }, function (cb) { + testHelper.runSqlFile(SQL_DIR + 'tcs_catalog__clean', 'tcs_catalog', cb); + }, function (cb) { + testHelper.runSqlFile(SQL_DIR + 'topcoder_dw__clean', 'topcoder_dw', cb); + } + ], done); + } + + /** + * This function is run before all tests. + * Generate tests data. + * @param {Function} done the callback + */ + before(function (done) { + async.waterfall([ + clearDb, + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'topcoder_dw__insert_test_data', 'topcoder_dw', cb); + }, + function (cb) { + testHelper.runSqlFiles(testHelper.generatePartPaths(SQL_DIR + 'tcs_catalog__insert_test_data', '', 2), + 'tcs_catalog', cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'informixoltp__insert_test_data', 'informixoltp', cb); + }, + function (cb) { + testHelper.updateTextColumn('update project_spec set detailed_requirements_text = ?', + 'tcs_catalog', [{type: 'text', value: 'software detail requirement'}], cb); + } + ], done); + }); + + /** + * This function is run after all tests. + * Clean up all data. + * @param {Function} done the callback + */ + after(function (done) { + clearDb(done); + }); + + /** + * Create a http request and test it. + * @param {String} url - the request url. + * @param {Number} expectStatus - the expected request response status. + * @param {Function} cb - the call back function. + */ + function createRequest(url, expectStatus, cb) { + request(API_ENDPOINT) + .get('/v2/challenges/rss' + url) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(expectStatus) + .end(cb); + } + + /** + * assert the bad response. + * @param {String} url - the request url + * @param {Number} expectStatus - the expect status. + * @param {String} errorMessage - the expected error message. + * @param {Function} cb - the callback function. + */ + function assertBadResponse(url, expectStatus, errorMessage, cb) { + createRequest(url, expectStatus, function (err, result) { + if (!err) { + assert.equal(result.body.error.details, errorMessage, 'invalid error message'); + } else { + cb(err); + return; + } + cb(); + }); + } + + /** + * Test when challengeType is invalid. + */ + it('should return bad Request. The challengeType is invalid.', function (done) { + assertBadResponse('?challengeType=abc', 400, errorObject.challengeType.invalid, done); + }); + + /** + * Test when listType is invalid. + */ + it('should return bad Request. The listType is invalid.', function (done) { + assertBadResponse('?listType=abc', 400, errorObject.listType.invalid, done); + }); + + /** + * Test when challengeType is 'all' which is invalid. + */ + it('should return bad Request. The challengeType is invalid.', function (done) { + assertBadResponse('?challengeType=all', 400, errorObject.challengeType.invalid, done); + }); + + /** + * The UPCOMING is not supported for data challenge. + */ + it('should return success results. The listType UPCOMING is not supported for data challenge.', function (done) { + createRequest('?listType=UPCOMING&challengeType=data', 200, function (err, result) { + if (err) { + done(err); + return; + } + assert.isTrue(_.isEmpty(result.body.data), 'invalid results'); + assert.equal(result.body.total, 0, 'invalid results'); + done(); + }); + }); + + /** + * Test open challenges only. + */ + it('should return success results. The results should contains OPEN/ACTIVE challenges only.', function (done) { + createRequest('?listType=ACTIVE', 200, function (err, result) { + if (err) { + done(err); + return; + } + delete result.body.requesterInformation; + delete result.body.serverInformation; + assert.deepEqual(result.body, require('./test_files/expected_get_challenge_rss_active'), 'invalid response'); + done(); + }); + }); + + /** + * Test upcoming challenges only. + */ + it('should return success results. The results should contains UPCOMING challenges only.', function (done) { + createRequest('?listType=upcoming', 200, function (err, result) { + if (err) { + done(err); + return; + } + delete result.body.requesterInformation; + delete result.body.serverInformation; + assert.deepEqual(result.body, require('./test_files/expected_get_challenge_rss_upcoming'), 'invalid response'); + done(); + }); + }); + + /** + * Test OPEN software challenges. + */ + it('should return success results. The results should contains open software challenges only.', function (done) { + createRequest('?listType=OPEN&challengeType=develop', 200, function (err, result) { + if (err) { + done(err); + return; + } + delete result.body.requesterInformation; + delete result.body.serverInformation; + assert.deepEqual(result.body, require('./test_files/expected_get_challenge_rss_develop_open'), 'invalid response'); + done(); + }); + }); + + /** + * Test OPEN studio challenges. + */ + it('should return success results. The results should contains open studio challenges only.', function (done) { + createRequest('?listType=OPEN&challengeType=design', 200, function (err, result) { + if (err) { + done(err); + return; + } + delete result.body.requesterInformation; + delete result.body.serverInformation; + assert.deepEqual(result.body, require('./test_files/expected_get_challenge_rss_design_open'), 'invalid response'); + done(); + }); + }); +}); diff --git a/test/test.marathonRegInfo.js b/test/test.marathonRegInfo.js new file mode 100755 index 000000000..1af1da449 --- /dev/null +++ b/test/test.marathonRegInfo.js @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author TCSASSEMBLER + */ +'use strict'; +/*global describe, it, before, beforeEach, after, afterEach */ +/*jslint node: true, stupid: true, unparam: true */ + +/** + * Module dependencies. + */ +var request = require('supertest'); +var assert = require('chai').assert; +var async = require('async'); + +var testHelper = require('./helpers/testHelper'); +var SQL_DIR = __dirname + '/sqls/marathonRegInfo/'; +var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080'; + +describe('Marathon Match Challenge Reg Info API', function () { + this.timeout(120000); // The api with testing remote db could be quit slow + + var heffan = testHelper.generateAuthHeader({ sub: 'ad|132456' }), + member1 = testHelper.generateAuthHeader({ sub: 'ad|132457' }), + member2 = testHelper.generateAuthHeader({ sub: 'ad|132458' }), + member3 = testHelper.generateAuthHeader({ sub: 'ad|124764' }), + member4 = testHelper.generateAuthHeader({ sub: 'ad|124772' }), + member5 = testHelper.generateAuthHeader({ sub: 'ad|124766' }), + forbiddenUser = testHelper.generateAuthHeader({ sub: 'ad|300001' }), + unActivatedUser = testHelper.generateAuthHeader({ sub: 'ad|300002' }), + notExistedUser = testHelper.generateAuthHeader({ sub: 'ad|1234567890' }), + iranUser = testHelper.generateAuthHeader({ sub: 'ad|300003' }); + + /** + * Clear database + * @param {Function} done the callback + */ + function clearDb(done) { + async.waterfall([ + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'informixoltp__clean', 'informixoltp', cb); + }, function (cb) { + testHelper.runSqlFile(SQL_DIR + 'common_oltp__clean', 'common_oltp', cb); + } + ], done); + } + + /** + * This function is run before all tests. + * Generate tests data. + * @param {Function} done the callback + */ + before(function (done) { + async.waterfall([ + clearDb, + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'common_oltp__insert_test_data', 'common_oltp', cb); + }, + function (cb) { + testHelper.runSqlFile(SQL_DIR + 'informixoltp__insert_test_data', 'informixoltp', cb); + }, + function (cb) { + testHelper.updateTextColumn('update round_terms set terms_content = ? where round_id IN (2001, 2006)', 'informixoltp', [{type: 'text', value : 'Marathon Match terms content'}], cb); + } + ], done); + }); + + /** + * This function is run after all tests. + * Clean up all data. + * @param {Function} done the callback + */ + after(function (done) { + clearDb(done); + }); + + /** + * Create a http request. + * @param {String} roundId - the request roundId. + * @param {Object} authHeader - the auth header for request. + */ + function createRequest(roundId, authHeader) { + var req = request(API_ENDPOINT) + .get('/v2/data/marathon/challenges/' + roundId + '/regInfo') + .set('Accept', 'application/json'); + if (authHeader) { + req.set('Authorization', authHeader); + } + return req.expect('Content-Type', /json/); + } + + /** + * Helper method for validating marathon match register information + * + * @param {String} roundId - the request roundId. + * @param {Object} authHeader - the auth header for request. + * @param {String} expectFile - the expect file path + * @param {Function} done - the callback function + */ + function validateResult(roundId, authHeader, expectFile, done) { + createRequest(roundId, authHeader).expect(200).end(function (err, res) { + if (err) { + done(err); + return; + } + var expected = require(expectFile); + delete res.body.serverInformation; + delete res.body.requesterInformation; + assert.deepEqual(res.body, expected, "Invalid response"); + done(); + }); + } + + /** + * Assert error request. + * + * @param {String} roundId - the request roundId. + * @param {Object} authHeader - the auth header for request. + * @param {Number} statusCode - the expected status code + * @param {String} errorDetail - the error detail. + * @param {Function} done the callback function + */ + function assertError(roundId, authHeader, statusCode, errorDetail, done) { + createRequest(roundId, authHeader).expect(statusCode).end(function (err, res) { + if (err) { + done(err); + return; + } + assert.equal(res.body.error.details, errorDetail, "Invalid error detail"); + done(); + }); + } + + /** + * Test when authorization is missing. + */ + it('should return authorized error. The authorization is missing.', function (done) { + assertError('2001', null, 401, 'Authorization information needed or incorrect.', done); + }); + + /** + * Test when roundId is not number. + */ + it('should return bad request. The roundId is not number.', function (done) { + assertError('abc', member1, 400, 'roundId should be number.', done); + }); + + /** + * Test when roundId is not integer. + */ + it('should return bad request. The roundId is not integer.', function (done) { + assertError('1.234', member1, 400, 'roundId should be Integer.', done); + }); + + /** + * Test when roundId is not positive. + */ + it('should return bad request. The roundId is not positive.', function (done) { + assertError('-1', member1, 400, 'roundId should be positive.', done); + }); + + /** + * Test when roundId is zero. + */ + it('should return bad request. The roundId is zero.', function (done) { + assertError('0', member1, 400, 'roundId should be positive.', done); + }); + + /** + * Test when roundId is too big. + */ + it('should return bad request. The roundId is too big.', function (done) { + assertError('2147483648', member1, 400, 'roundId should be less or equal to 2147483647.', done); + }); + + /** + * Test when user is forbidden to access register endpoint. + */ + it('should return bad request. The user don\'t have the access to register endpoint.', function (done) { + assertError('2001', forbiddenUser, 403, 'The user is forbidden to access this endpoint.', done); + }); + + /** + * Test when user is not activated. + */ + it('should return bad request. The user is not activated.', function (done) { + assertError('2001', unActivatedUser, 400, 'You are not eligible to participate in this competition.', done); + }); + + /** + * Test when user is not existed. + */ + it('should return bad request. The user is not existed.', function (done) { + assertError('2001', notExistedUser, 500, 'user not found with id=1234567890', done); + }); + + /** + * Test when round is not existed. + */ + it('should return bad request. The challenge round is not existed.', function (done) { + assertError('3001', member1, 400, 'Round doesn\'t exist 3001.', done); + }); + + /** + * Test when round has a event but the user didn't register it. + */ + it('should return bad request. The event not registered.', function (done) { + assertError('2001', member2, 400, 'In order to participate in this competition, you must register for ' + + 'Test Event 2001. Registration is available: here. ' + + 'Please register at the provided URL first and then repeat registration at Marathon Match Active Contests page.', done); + }); + + /** + * Test when registration of round event is not eligible. + */ + it('should return bad request. The registration of event is not eligible.', function (done) { + assertError('2001', member3, 400, 'You are not eligible to participate in this competition.', done); + }); + + /** + * Test when round registration is closed. + */ + it('should return bad request. The round registration is closed.', function (done) { + assertError('2002', member1, 400, 'Registration is not currently open.', done); + }); + + /** + * Test when user is in a invalid country. + */ + it('should return bad request. The user is in invalid country.', function (done) { + assertError('2001', iranUser, 400, 'You are not eligible to participate in this competition. Please contact support@topcoder.com if you have any questions.', done); + }); + + /** + * Test when round is required invitation and the user don't have one. + */ + it('should return bad request. The user is not invited to this challenge.', function (done) { + assertError('2003', member1, 400, 'Sorry, this round is by invitation only.', done); + }); + + /** + * Test when the round is parallel round. + */ + it('should return bad request. The round is parallel round.', function (done) { + assertError('2004', member4, 400, 'Sorry, you can not register for this round, you must compete in the version of this round that you were invited to.', done); + }); + + /** + * Test when the round term doesn't exist. + */ + it('should return not found. The round term doesn\'t exist.', function (done) { + assertError('2007', heffan, 404, 'Could not find specified round terms.', done); + }); + + /** + * Test when the round meet registration limit. + */ + it('should return bad request. The round has no empty positions for registrants.', function (done) { + async.waterfall([ + function (cb) { + testHelper.runSqlQuery('UPDATE round SET registration_limit = 0 WHERE round_id = 2001', 'informixoltp', cb); + }, + function (cb) { + assertError('2001', heffan, 400, 'There are no more spots available for the round.', cb); + }, + function (cb) { + testHelper.runSqlQuery('UPDATE round SET registration_limit = 10 WHERE round_id = 2001', 'informixoltp', cb); + } + ], done); + }); + + /** + * Get marathon match register information for round 2001. + * Expect success results. + */ + it('should return success results for round 2001', function (done) { + validateResult('2001', heffan, './test_files/expected_marathon_reg_info.json', done); + }); + + /** + * Get marathon match register information for round 2001. + * user twight already register round 2001, expect success results. + */ + it('should return success results for round 2001 when user already register', function (done) { + validateResult('2001', member5, './test_files/expected_marathon_reg_info.json', done); + }); + + /** + * Get marathon match register information for round 2006. + * Expect success results with empty questions. + */ + it('should return success results with empty questions for round 2006', function (done) { + validateResult('2006', heffan, './test_files/expected_marathon_reg_info_empty_questions.json', done); + }); +}); diff --git a/test/test.register_member.js b/test/test.register_member.js index 8de202468..2e294aeb4 100644 --- a/test/test.register_member.js +++ b/test/test.register_member.js @@ -253,7 +253,7 @@ describe('Test Register Member API', function () { it('should register successfully', function (done) { supertest(API_ENDPOINT) .post('/v2/users').set('Accept', 'application/json') - .send({ firstName: 'foo', lastName: 'bar', handle: 'testHandleFoo', email: 'testHandleFoo@foobar.com', password: '123456', country: 'Japan', socialProviderId: 1, socialUserName: "foobar", socialEmail: "foobar@foobar.com", socialEmailVerified: 't', regSource: "source1", "socialUserId": 2 }) + .send({ firstName: 'foo', lastName: 'bar', handle: 'testHandleFoo', email: 'testHandleFoo@foobar.com', password: '123456', country: 'Japan', socialProviderId: 1, socialUserName: "foobar", socialEmail: "foobar@foobar.com", socialEmailVerified: 't', regSource: "source1", "socialUserId": 2, utm_source: "some source", utm_medium: "some medium", utm_campaign: "some campaign"}) .expect('Content-Type', /json/) .expect(200) .end(function (err, result) { diff --git a/test/test.resetPassword.js b/test/test.resetPassword.js new file mode 100644 index 000000000..3209535ec --- /dev/null +++ b/test/test.resetPassword.js @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. + * + * @version 1.0 + * @author isv + */ +"use strict"; + +/*global describe, it, before, beforeEach, after, afterEach, __dirname */ +/*jslint node: true, stupid: true, unparam: true */ + +/** + * Module dependencies. + */ +var request = require('supertest'); +var assert = require('chai').assert; +var async = require('async'); +var testHelper = require('./helpers/testHelper'); +var stringUtils = require("../common/stringUtils.js"); +var redis = require('redis'); + +var API_ENDPOINT = process.env.API_ENDPOINT || 'http://localhost:8080'; +var SQL_DIR = __dirname + "/sqls/resetPassword/"; +var DATABASE_NAME = "common_oltp"; +var TOKEN_LIFETIME = require('../config').config.general.defaultResetPasswordTokenCacheLifetime; +var IS_FAKE_REDIS_USED = require('../config').config.redis.fake; +if (typeof TOKEN_LIFETIME === 'string') { + TOKEN_LIFETIME = parseInt(TOKEN_LIFETIME, 10); +} + +var CLIENT_ID = require('../config').config.general.oauthClientId; +var SECRET = require('../config').config.general.oauthClientSecret; +var jwt = require('jsonwebtoken'); + +describe('Test Generate Reset Token API', function () { + + /** + * Gets the token which must have been generated for the specified user and saved to Redis database. + * + * @param {String} handle - the username to get the token for. + * @param {Function} callback - the callback function. + */ + function getCachedToken(handle, callback) { + var client = redis.createClient(); + client.get('tokens-' + handle + '-reset-token', function (err, value) { + callback(err, JSON.parse(value)); + }); + client.quit(); + } + + /** + * Delays the execution of current thread to let the token generated previously ot expire. + */ + function delay() { + var delayPeriod = TOKEN_LIFETIME + 1000, + now = new Date(), + desiredTime = new Date(); + desiredTime.setTime(now.getTime() + delayPeriod); + while (now < desiredTime) { + now = new Date(); + } + console.log("The token should have expired."); + } + + /** + * Clear database + * @param {Function} done the callback + */ + function clearDb(done) { + testHelper.runSqlFile(SQL_DIR + "common_oltp__clean", DATABASE_NAME, done); + } + + /** + * This function is run before all tests. + * Generate tests data. + * @param {Function} done the callback + */ + before(function (done) { + async.waterfall([ + clearDb, + function (cb) { + testHelper.runSqlFile(SQL_DIR + "common_oltp__insert_test_data", DATABASE_NAME, cb); + } + ], done); + }); + + /** + * This function is run after all tests. + * Clean up all data. + * @param {Function} done the callback + */ + after(function (done) { + clearDb(done); + }); + + /** + * Tests the generateResetToken action against failure test case. Posts a request for generating the token for + * user specified by handle or email and expects the server to respond with HTTP response of specified status + * providing the specified expected error details. + * + * @param {String} handle - a handle for user to pass to tested action. + * @param {String} email - an email for user to pass to tested action. + * @param {Number} expectedStatusCode - status code for HTTP response expected to be returned from server. + * @param {String} expectedErrorMessage - error message expected to be returned from server. + * @param {Function} callback - a callback to be called when test finishes. + */ + function testFailureScenario(handle, email, expectedStatusCode, expectedErrorMessage, callback) { + var queryParams = '?'; + if (handle !== null) { + queryParams += 'handle=' + handle; + } + if (email !== null) { + queryParams += '&email=' + email; + } + + request(API_ENDPOINT) + .get('/v2/users/resetToken' + queryParams) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(expectedStatusCode) + .end(function (err, res) { + if (err) { + callback(err); + return; + } + var body = res.body; + assert.equal(body.error.details, expectedErrorMessage); + callback(); + }); + } + + /** + * Tests the generateResetToken action against success test case. Posts a request for generating the token for + * user specified by handle or email and expects the server to respond with HTTP response of 200 OK status and + * return generated token or social login provider name in case the handle or email corresponds to social login. + * + * @param {String} handle - a handle for user to pass to tested action. + * @param {String} email - an email for user to pass to tested action. + * @param {String} socialLoginProvider - a name for social login provider in case specified handle is from social + * login. + * @param {Function} callback - a callback to be called when test finishes. + * @param {String} handleForEmail - a user handle corresponding to specified email address. This is just for tests + * which pass email and expect the token to be generated. + * @param {boolean} skipCheckingTokenInRedis - flag indicating if test has skip checking the token for presence in + * Redis database. + */ + function testSuccessScenario(handle, email, socialLoginProvider, callback, handleForEmail, skipCheckingTokenInRedis) { + var queryParams = '?'; + if (handle !== null) { + queryParams += 'handle=' + handle; + } + if (email !== null) { + queryParams += '&email=' + email; + } + + request(API_ENDPOINT) + .get('/v2/users/resetToken' + queryParams) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .end(function (err, res) { + assert.notOk(err, 'There should be no error for successful scenario'); + + var body = res.body, + alphabet = stringUtils.ALPHABET_ALPHA_EN + stringUtils.ALPHABET_DIGITS_EN, + i, + ch; + + if (socialLoginProvider === null) { + assert.ok(body.successful, "There is no successful returned"); + assert.isTrue(body.successful, "Wrong successful flag is returned"); + if (!IS_FAKE_REDIS_USED && !skipCheckingTokenInRedis) { + async.waterfall([ + function (cb) { + if (handle) { + getCachedToken(handle, cb); + } else { + getCachedToken(handleForEmail, cb); + } + } + ], function (err, token) { + assert.ok(token, 'The token is not stored in Redis database'); + assert.equal(token.value.length, 6, "Token of wrong length returned"); + for (i = 0; i < token.value.length; i = i + 1) { + ch = token.value.charAt(i); + assert.isTrue(alphabet.indexOf(ch) >= 0, "Token contains wrong character '" + ch + "'"); + } + callback(err); + }); + } else { + callback(); + } + } else { + assert.ok(body.socialProvider, "There is no social login provider name returned"); + assert.equal(body.socialProvider, socialLoginProvider, "Wrong social login provider name returned"); + callback(); + } + }); + } + + // Failure test cases + it('Neither handle nor email are provided - should return HTTP 400', function (done) { + testFailureScenario(null, null, 400, 'Either handle or email must be specified', done); + }); + + it('Both handle and email are provided - should return HTTP 400', function (done) { + testFailureScenario("heffan", "foo@bar.com", 400, 'Both handle and email are specified', done); + }); + + it('Both empty handle and email are provided - should return HTTP 400', function (done) { + testFailureScenario("", "", 400, 'Either handle or email must be specified', done); + }); + + it('Empty handle provided - should return HTTP 400', function (done) { + testFailureScenario("", null, 400, 'Either handle or email must be specified', done); + }); + + it('Empty email provided - should return HTTP 400', function (done) { + testFailureScenario(null, "", 400, 'Either handle or email must be specified', done); + }); + + it('Non-existing handle is provided - should return HTTP 404', function (done) { + testFailureScenario("Undioiwfibiiv3vb3i", null, 404, 'User does not exist', done); + }); + + it('Non-existing email is provided - should return HTTP 404', function (done) { + testFailureScenario(null, '912837197@akjsdnakd.com', 404, 'User does not exist', done); + }); + + it('Non-expired token already exists - should return HTTP 400', function (done) { + // Increasing timeout as there is a need for thread to sleep in this test case in order to cause the + // generated token to expire + this.timeout(TOKEN_LIFETIME * 2); + + async.waterfall([ + function (cb) { + testSuccessScenario('normal_user_11', null, null, cb, null, false); + }, function (cb) { + testFailureScenario('normal_user_11', null, 400, "You have already requested the reset token, " + + "please find it in your email inbox. If it's not there. Please contact support@topcoder.com.", + cb); + }, function (cb) { + console.log("\nWaiting for generated token to expire to prevent multiple test suite execution to fail (" + + (TOKEN_LIFETIME + 1000) / 1000 + " sec)..."); + delay(); + cb(); + } + ], function (err) { + done(err); + }); + }); + + // Accuracy test cases + it('Existing TopCoder username is provided - should respond with HTTP 200 and return token', function (done) { + testSuccessScenario('normal_user_13', null, null, done, null, false); + }); + + it('Existing email address is provided - should respond with HTTP 200 and return token', function (done) { + testSuccessScenario(null, 'normal_user_14@test.com', null, done, 'normal_user_14', false); + }); + + it('Existing social login handle is provided - should respond with HTTP 200 and provider name', function (done) { + testSuccessScenario('user2', null, 'Facebook', done, null, true); + }); + + it('Existing social login email is provided - should respond with HTTP 200 and provider name', function (done) { + testSuccessScenario(null, 'social.email21@test.com', 'Twitter', done, null, true); + }); + + it('Username that matches handle for TC user account (which also have a social login username) and social ' + + 'login username for another TC user account is provided - should respond with HTTP 200 and social ' + + 'provider name for user with matching TC handle', function (done) { + testSuccessScenario('common_handle', null, 'Google', done, null, true); + }); + + it('Username that matches handle for TC user account (which does not have a social login username) and social ' + + 'login username for another TC user account is provided - should respond with HTTP 200 and generated ' + + 'token for user with matching TC handle', function (done) { + testSuccessScenario('common_handle2', null, null, done, null, false); + }); + + it('Email address that matches email for TC user account (which also have a social login username) and social ' + + 'login email for another TC user account is provided - should respond with HTTP 200 and social ' + + 'provider name for user with matching TC email address', function (done) { + testSuccessScenario(null, 'common_email@test.com', 'Google', done, null, true); + }); + + it('Email address that matches email for TC user account (which does not have a social login account) and social ' + + 'login email for another TC user account is provided - should respond with HTTP 200 and generated ' + + 'token for user with matching TC email', function (done) { + testSuccessScenario(null, 'common_email2@test.com', null, done, 'normal_user_25', false); + }); + + it('Requesting new token once previous has expired - should respond with HTTP 200 and new token', function (done) { + // Increasing timeout as there is a need for thread to sleep in this test case in order to cause the + // generated token to expire + this.timeout(TOKEN_LIFETIME * 2); + + async.waterfall([ + function (cb) { + testSuccessScenario('normal_user_15', null, null, cb, null, false); + }, function (cb) { + console.log("\nWaiting for generated token to expire (" + (TOKEN_LIFETIME + 1000) / 1000 + " sec)..."); + delay(); + testSuccessScenario('normal_user_15', null, null, cb, null, true); + } + ], function (err) { + done(err); + }); + }); +}); diff --git a/test/test.softwareReviewOpportunityDetails.js b/test/test.softwareReviewOpportunityDetails.js index 82545b8a6..e850f3559 100644 --- a/test/test.softwareReviewOpportunityDetails.js +++ b/test/test.softwareReviewOpportunityDetails.js @@ -2,7 +2,7 @@ * Copyright (C) 2014 TopCoder Inc., All Rights Reserved. * * @version 1.0 - * @author TCSASSEMBLER + * @author Ghost_141 */ 'use strict'; /*global describe, it, before, beforeEach, after, afterEach */ diff --git a/test/test.submitDevelopChallenge.js b/test/test.submitDevelopChallenge.js index b86e37ab6..65227bc44 100644 --- a/test/test.submitDevelopChallenge.js +++ b/test/test.submitDevelopChallenge.js @@ -70,14 +70,13 @@ describe('Submit for develop challenge', function () { * @param {Object} user the user to authenticate * @param {Number} expectedStatusCode the expected status code of the response */ - function getRequest(url, user, expectedStatusCode, file) { + function getRequest(url, user, expectedStatusCode) { var req = request(API_ENDPOINT) .post(url) .set('Accept', 'application/json') .set('Authorization', getAuthHeader(user)) .expect('Content-Type', /json/) - .expect(expectedStatusCode) - .attach('submissionFile', file); + .expect(expectedStatusCode); return req; } @@ -154,9 +153,11 @@ describe('Submit for develop challenge', function () { * the thurgood id must be set in submission table */ it('should submit successfully', function (done) { - var req = getRequest('/v2/develop/challenges/77701/submit', user124764, 200, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77701/submit', user124764, 200); + var buffer = fs.readFileSync(sampleSubmissionPath); - req.end(function (err, resp) { + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -226,9 +227,11 @@ describe('Submit for develop challenge', function () { * the thurgood id must NOT be set in submission table because it applies only to final submissions */ it('should submit checkpoint successfully', function (done) { - var req = getRequest('/v2/develop/challenges/77701/submit?type=checkpoint', user124764, 200, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77701/submit?type=checkpoint', user124764, 200); + var buffer = fs.readFileSync(sampleSubmissionPath); - req.end(function (err, resp) { + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -297,9 +300,11 @@ describe('Submit for develop challenge', function () { * the thurgood id in the submission table must be null */ it('should submit successfully for project with no thurgood properties', function (done) { - var req = getRequest('/v2/develop/challenges/77707/submit', user124764, 200, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77707/submit', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); - req.end(function (err, resp) { + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -335,33 +340,37 @@ describe('Submit for develop challenge', function () { async.series([ function (cb) { - var req = getRequest('/v2/develop/challenges/77708/submit?type=checkpoint', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77708/submit?type=checkpoint', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { c1uid = resp.body.uploadId; c1sid = resp.body.submissionId; cb(err); }); }, function (cb) { - var req = getRequest('/v2/develop/challenges/77708/submit?type=checkpoint', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77708/submit?type=checkpoint', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { c2uid = resp.body.uploadId; c2sid = resp.body.submissionId; cb(err); }); }, function (cb) { - var req = getRequest('/v2/develop/challenges/77708/submit', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77708/submit', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { s1uid = resp.body.uploadId; s1sid = resp.body.submissionId; cb(err); }); }, function (cb) { - var req = getRequest('/v2/develop/challenges/77708/submit', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77708/submit', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { s2uid = resp.body.uploadId; s2sid = resp.body.submissionId; cb(err); @@ -415,33 +424,37 @@ describe('Submit for develop challenge', function () { async.series([ function (cb) { - var req = getRequest('/v2/develop/challenges/77709/submit?type=checkpoint', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77709/submit?type=checkpoint', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { c1uid = resp.body.uploadId; c1sid = resp.body.submissionId; cb(err); }); }, function (cb) { - var req = getRequest('/v2/develop/challenges/77709/submit?type=checkpoint', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77709/submit?type=checkpoint', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { c2uid = resp.body.uploadId; c2sid = resp.body.submissionId; cb(err); }); }, function (cb) { - var req = getRequest('/v2/develop/challenges/77709/submit', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77709/submit', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { s1uid = resp.body.uploadId; s1sid = resp.body.submissionId; cb(err); }); }, function (cb) { - var req = getRequest('/v2/develop/challenges/77709/submit', user124764, 200, sampleSubmissionPath); - - req.end(function (err, resp) { + var req = getRequest('/v2/develop/challenges/77709/submit', user124764, 200), + buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { s2uid = resp.body.uploadId; s2sid = resp.body.submissionId; cb(err); @@ -483,12 +496,14 @@ describe('Submit for develop challenge', function () { * should return 401 error */ it('should return 401 error when not logged-in', function (done) { - request(API_ENDPOINT) + var req = request(API_ENDPOINT) .post('/v2/develop/challenges/77701/submit') .set('Accept', 'application/json') .expect('Content-Type', /json/) - .expect(401) - .attach('submissionFile', sampleSubmissionPath) + .expect(401); + + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) .end(done); }); @@ -497,7 +512,11 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error challenge id is not a number', function (done) { - getRequest('/v2/develop/challenges/blah/submit', user124764, 400, sampleSubmissionPath).end(done); + var req = getRequest('/v2/develop/challenges/blah/submit', user124764, 400); + + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(done); }); /** @@ -505,7 +524,34 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error challenge id is too large', function (done) { - getRequest('/v2/develop/challenges/2893473289749283749237489327498273497238947/submit', user124764, 400, sampleSubmissionPath).end(done); + var req = getRequest('/v2/develop/challenges/2893473289749283749237489327498273497238947/submit', user124764, 400); + + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(done); + }); + + /** + * Test /v2/develop/challenges/:challengeId/submit when file data is empty + * should return 400 error + */ + it('should return 400 error when file data is empty', function (done) { + var req = getRequest('/v2/develop/challenges/77701/submit', user124764, 400); + + req.send({ fileName: 'sample_submission.zip', fileData: ' ' }) + .end(done); + }); + + /** + * Test /v2/develop/challenges/:challengeId/submit when file name is empty + * should return 400 error + */ + it('should return 400 error when file name is empty', function (done) { + var req = getRequest('/v2/develop/challenges/77701/submit', user124764, 400); + + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: ' ', fileData: buffer.toString('base64') }) + .end(done); }); /** @@ -513,7 +559,23 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error when type is not allowed', function (done) { - getRequest('/v2/develop/challenges/77701/submit?type=nono', user124764, 400, sampleSubmissionPath).end(done); + var req = getRequest('/v2/develop/challenges/77701/submit?type=nono', user124764, 400); + + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(done); + }); + + /** + * Test /v2/develop/challenges/:challengeId/submit when file name is more than 256 chars + * should return 400 error + */ + it('should return 400 error when file name is more than 256 chars', function (done) { + var req = getRequest('/v2/develop/challenges/77701/submit', user124764, 400); + + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'kdhbfkjdshfkjshdkfjhsdkjfhdskjfhksjdhfkjdshfkjdshfkjsdhfkjdshfkjdshfkjdshfkjhdskjfhsdkjfhkjsdhfkjsdhfkjsdhfkjshdkjfhsdkjfhskjdhfkjdshfkjshdkjfhskjdfhskjdfhkjsdhfkjsdhfkjdshfkjhsdkjfhkjsdhfkjdshfkjshdfkjhsdkjfhkjsdhfkjdshkjfhskjdfhkjsdhfkjsdhfkjhsdkjfhkjsdhfkjsdhkjdsjfkhskjdhfkjsdhfkjsh.txt', fileData: buffer.toString('base64') }) + .end(done); }); /** @@ -521,9 +583,11 @@ describe('Submit for develop challenge', function () { * should return 404 error */ it('should return 404 error when contest does not exist', function (done) { - var req = getRequest('/v2/develop/challenges/77799/submit', user124764, 404, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77799/submit', user124764, 404); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -538,9 +602,11 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error when contest is not a develop challenge', function (done) { - var req = getRequest('/v2/develop/challenges/77702/submit', user124764, 400, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77702/submit', user124764, 400); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -555,9 +621,11 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error when contest submission phase is not open', function (done) { - var req = getRequest('/v2/develop/challenges/77703/submit', user124764, 400, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77703/submit', user124764, 400); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -572,9 +640,11 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error when type is checkpoint and checkpoint submission phase is not open', function (done) { - var req = getRequest('/v2/develop/challenges/77704/submit?type=checkpoint', user124764, 400, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77704/submit?type=checkpoint', user124764, 400); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -589,9 +659,11 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error when contest type is MM', function (done) { - var req = getRequest('/v2/develop/challenges/77705/submit', user124764, 400, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77705/submit', user124764, 400); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -606,9 +678,11 @@ describe('Submit for develop challenge', function () { * should return 400 error */ it('should return 400 error when contest type is Spec Review', function (done) { - var req = getRequest('/v2/develop/challenges/77706/submit', user124764, 400, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77706/submit', user124764, 400); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -623,9 +697,11 @@ describe('Submit for develop challenge', function () { * should return 403 error */ it('should return 403 error when user does not have Submitter role', function (done) { - var req = getRequest('/v2/develop/challenges/77701/submit', user124834, 403, sampleSubmissionPath); + var req = getRequest('/v2/develop/challenges/77701/submit', user124834, 403); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPath); + req.send({ fileName: 'sample_submission.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; @@ -640,9 +716,11 @@ describe('Submit for develop challenge', function () { * should return 413 error */ it('should return 413 error user submits a file which is larger than what we have configured', function (done) { - var req = getRequest('/v2/develop/challenges/77701/submit', user124764, 413, sampleSubmissionPathTooLarge); + var req = getRequest('/v2/develop/challenges/77701/submit', user124764, 413); - req.end(function (err, resp) { + var buffer = fs.readFileSync(sampleSubmissionPathTooLarge); + req.send({ fileName: 'sample_submission_too_large.zip', fileData: buffer.toString('base64') }) + .end(function (err, resp) { if (err) { done(err); return; diff --git a/test/test_files/expected_apply_software_review_opportunities_response_message.json b/test/test_files/expected_apply_software_review_opportunities_response_message.json new file mode 100644 index 000000000..b1dc73519 --- /dev/null +++ b/test/test_files/expected_apply_software_review_opportunities_response_message.json @@ -0,0 +1,26 @@ +{ + "challengeId" : { + "notNumber": "challengeId should be number.", + "notPositive": "challengeId should be positive.", + "notInteger": "challengeId should be Integer.", + "tooBig": "challengeId should be less or equal to 2147483647." + }, + "unauthorized": "Anonymous user don't have permission to access this api.", + "invalidReviewApplicationRole": "reviewApplicationRoleId should be an element of 1,2,3,4,5,6,7,8,9.", + "invalidReviewApplicationId": "You can't apply the review application role that do not belong to this challenge.", + "notSupportedReviewApplicationRoleId": "You can't apply the review application role that do not belong to this challenge.", + "notReviewer": "You are not a Review Board member.", + "forbidden": "The user is not allowed to register this challenge review.", + "alreadyAReviewer": "You are already assigned as reviewer for the contest.", + "noOpenPositions": "There are no open positions for this challenge.", + "noPositionsForPrimaryReviewer": "There is no open positions for selected review application role: Primary Reviewer.", + "noPositionsForSecondaryReviewer": "There is no open positions for selected review application role: Secondary Reviewer.", + "invalidChallenge": "The challenge is not existed or don't have any review opportunities or review registration is not open.", + "notAgreedTerms": "You should agree with all terms of use.", + "success": { + "afterAssignment": "You have successfully applied to review this contest. The system will automatically decide whether you match the reviewer requirements for this contest now. You will be notified by email shortly.", + "beforeAssignmentPrefix": "You have successfully applied to review this contest. The system will automatically select reviewers that best match the review positions for this contest on ", + "beforeAssignmentSuffix": ". You will be notified by email what review role you were assigned to.", + "cancelled": "Your review application for this contest has been cancelled." + } +} 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/expected_get_challenge_rss_active.json b/test/test_files/expected_get_challenge_rss_active.json new file mode 100644 index 000000000..d97e94b52 --- /dev/null +++ b/test/test_files/expected_get_challenge_rss_active.json @@ -0,0 +1,685 @@ +{ + "data": [ + { + "challengeType": "Application Front-End Design", + "challengeName": "ACTIVE Studio Challenge 2081", + "challengeId": 2081, + "detailedRequirements": "", + "projectId": 2081 + }, + { + "challengeType": "Logo Design", + "challengeName": "ACTIVE Studio Challenge 2082", + "challengeId": 2082, + "detailedRequirements": "", + "projectId": 2082 + }, + { + "challengeType": "Front-End Flash", + "challengeName": "ACTIVE Studio Challenge 2083", + "challengeId": 2083, + "detailedRequirements": "", + "projectId": 2083 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "ACTIVE Studio Challenge 2084", + "challengeId": 2084, + "detailedRequirements": "", + "projectId": 2084 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "ACTIVE Studio Challenge 2085", + "challengeId": 2085, + "detailedRequirements": "", + "projectId": 2085 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "ACTIVE Studio Challenge 2086", + "challengeId": 2086, + "detailedRequirements": "", + "projectId": 2086 + }, + { + "challengeType": "Wireframes", + "challengeName": "ACTIVE Studio Challenge 2087", + "challengeId": 2087, + "detailedRequirements": "", + "projectId": 2087 + }, + { + "challengeType": "Application Front-End Design", + "challengeName": "ACTIVE Studio Challenge 2088", + "challengeId": 2088, + "detailedRequirements": "", + "projectId": 2088 + }, + { + "challengeType": "Idea Generation", + "challengeName": "ACTIVE Studio Challenge 2089", + "challengeId": 2089, + "detailedRequirements": "", + "projectId": 2089 + }, + { + "challengeType": "Logo Design", + "challengeName": "ACTIVE Studio Challenge 2090", + "challengeId": 2090, + "detailedRequirements": "", + "projectId": 2090 + }, + { + "challengeType": "Other", + "challengeName": "ACTIVE Studio Challenge 2091", + "challengeId": 2091, + "detailedRequirements": "", + "projectId": 2091 + }, + { + "challengeType": "Other", + "challengeName": "ACTIVE Studio Challenge 2092", + "challengeId": 2092, + "detailedRequirements": "", + "projectId": 2092 + }, + { + "challengeType": "Application Front-End Design", + "challengeName": "ACTIVE Studio Challenge 2093", + "challengeId": 2093, + "detailedRequirements": "", + "projectId": 2093 + }, + { + "challengeType": "Web Design", + "challengeName": "ACTIVE Studio Challenge 2094", + "challengeId": 2094, + "detailedRequirements": "", + "projectId": 2094 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "ACTIVE Studio Challenge 2095", + "challengeId": 2095, + "detailedRequirements": "", + "projectId": 2095 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "ACTIVE Studio Challenge 2096", + "challengeId": 2096, + "detailedRequirements": "", + "projectId": 2096 + }, + { + "challengeType": "Logo Design", + "challengeName": "ACTIVE Studio Challenge 2097", + "challengeId": 2097, + "detailedRequirements": "", + "projectId": 2097 + }, + { + "challengeType": "Application Front-End Design", + "challengeName": "ACTIVE Studio Challenge 2098", + "challengeId": 2098, + "detailedRequirements": "", + "projectId": 2098 + }, + { + "challengeType": "Logo Design", + "challengeName": "ACTIVE Studio Challenge 2099", + "challengeId": 2099, + "detailedRequirements": "", + "projectId": 2099 + }, + { + "challengeType": "Wireframes", + "challengeName": "ACTIVE Studio Challenge 2100", + "challengeId": 2100, + "detailedRequirements": "", + "projectId": 2100 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "OPEN Studio Challenge 2101", + "challengeId": 2101, + "detailedRequirements": "", + "projectId": 2101 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "OPEN Studio Challenge 2102", + "challengeId": 2102, + "detailedRequirements": "", + "projectId": 2102 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2103", + "challengeId": 2103, + "detailedRequirements": "", + "projectId": 2103 + }, + { + "challengeType": "Wireframes", + "challengeName": "OPEN Studio Challenge 2104", + "challengeId": 2104, + "detailedRequirements": "", + "projectId": 2104 + }, + { + "challengeType": "Wireframes", + "challengeName": "OPEN Studio Challenge 2105", + "challengeId": 2105, + "detailedRequirements": "", + "projectId": 2105 + }, + { + "challengeType": "Wireframes", + "challengeName": "OPEN Studio Challenge 2106", + "challengeId": 2106, + "detailedRequirements": "", + "projectId": 2106 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2107", + "challengeId": 2107, + "detailedRequirements": "", + "projectId": 2107 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2108", + "challengeId": 2108, + "detailedRequirements": "", + "projectId": 2108 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "OPEN Studio Challenge 2109", + "challengeId": 2109, + "detailedRequirements": "", + "projectId": 2109 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2110", + "challengeId": 2110, + "detailedRequirements": "", + "projectId": 2110 + }, + { + "challengeType": "Idea Generation", + "challengeName": "OPEN Studio Challenge 2111", + "challengeId": 2111, + "detailedRequirements": "", + "projectId": 2111 + }, + { + "challengeType": "Front-End Flash", + "challengeName": "OPEN Studio Challenge 2112", + "challengeId": 2112, + "detailedRequirements": "", + "projectId": 2112 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2113", + "challengeId": 2113, + "detailedRequirements": "", + "projectId": 2113 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2114", + "challengeId": 2114, + "detailedRequirements": "", + "projectId": 2114 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "OPEN Studio Challenge 2115", + "challengeId": 2115, + "detailedRequirements": "", + "projectId": 2115 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2116", + "challengeId": 2116, + "detailedRequirements": "", + "projectId": 2116 + }, + { + "challengeType": "Idea Generation", + "challengeName": "OPEN Studio Challenge 2117", + "challengeId": 2117, + "detailedRequirements": "", + "projectId": 2117 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2118", + "challengeId": 2118, + "detailedRequirements": "", + "projectId": 2118 + }, + { + "challengeType": "Front-End Flash", + "challengeName": "OPEN Studio Challenge 2119", + "challengeId": 2119, + "detailedRequirements": "", + "projectId": 2119 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "OPEN Studio Challenge 2120", + "challengeId": 2120, + "detailedRequirements": "", + "projectId": 2120 + }, + { + "challengeType": "Content Creation", + "challengeName": "ACTIVE Software Challenge 2001", + "challengeId": 2001, + "detailedRequirements": "software detail requirement", + "projectId": 2001 + }, + { + "challengeType": "RIA Component", + "challengeName": "ACTIVE Software Challenge 2002", + "challengeId": 2002, + "detailedRequirements": "software detail requirement", + "projectId": 2002 + }, + { + "challengeType": "Test Suites", + "challengeName": "ACTIVE Software Challenge 2003", + "challengeId": 2003, + "detailedRequirements": "software detail requirement", + "projectId": 2003 + }, + { + "challengeType": "RIA Component", + "challengeName": "ACTIVE Software Challenge 2004", + "challengeId": 2004, + "detailedRequirements": "software detail requirement", + "projectId": 2004 + }, + { + "challengeType": "Assembly Competition", + "challengeName": "ACTIVE Software Challenge 2005", + "challengeId": 2005, + "detailedRequirements": "software detail requirement", + "projectId": 2005 + }, + { + "challengeType": "Test Suites", + "challengeName": "ACTIVE Software Challenge 2006", + "challengeId": 2006, + "detailedRequirements": "software detail requirement", + "projectId": 2006 + }, + { + "challengeType": "Code", + "challengeName": "ACTIVE Software Challenge 2007", + "challengeId": 2007, + "detailedRequirements": "software detail requirement", + "projectId": 2007 + }, + { + "challengeType": "First2Finish", + "challengeName": "ACTIVE Software Challenge 2008", + "challengeId": 2008, + "detailedRequirements": "software detail requirement", + "projectId": 2008 + }, + { + "challengeType": "Development", + "challengeName": "ACTIVE Software Challenge 2009", + "challengeId": 2009, + "detailedRequirements": "software detail requirement", + "projectId": 2009 + }, + { + "challengeType": "Reporting", + "challengeName": "ACTIVE Software Challenge 2010", + "challengeId": 2010, + "detailedRequirements": "software detail requirement", + "projectId": 2010 + }, + { + "challengeType": "UI Prototypes", + "challengeName": "ACTIVE Software Challenge 2011", + "challengeId": 2011, + "detailedRequirements": "software detail requirement", + "projectId": 2011 + }, + { + "challengeType": "Bug Hunt", + "challengeName": "ACTIVE Software Challenge 2012", + "challengeId": 2012, + "detailedRequirements": "software detail requirement", + "projectId": 2012 + }, + { + "challengeType": "Content Creation", + "challengeName": "ACTIVE Software Challenge 2013", + "challengeId": 2013, + "detailedRequirements": "software detail requirement", + "projectId": 2013 + }, + { + "challengeType": "First2Finish", + "challengeName": "ACTIVE Software Challenge 2014", + "challengeId": 2014, + "detailedRequirements": "software detail requirement", + "projectId": 2014 + }, + { + "challengeType": "UI Prototypes", + "challengeName": "ACTIVE Software Challenge 2015", + "challengeId": 2015, + "detailedRequirements": "software detail requirement", + "projectId": 2015 + }, + { + "challengeType": "Development", + "challengeName": "ACTIVE Software Challenge 2016", + "challengeId": 2016, + "detailedRequirements": "software detail requirement", + "projectId": 2016 + }, + { + "challengeType": "Reporting", + "challengeName": "ACTIVE Software Challenge 2017", + "challengeId": 2017, + "detailedRequirements": "software detail requirement", + "projectId": 2017 + }, + { + "challengeType": "Conceptualization", + "challengeName": "ACTIVE Software Challenge 2018", + "challengeId": 2018, + "detailedRequirements": "software detail requirement", + "projectId": 2018 + }, + { + "challengeType": "RIA Component", + "challengeName": "ACTIVE Software Challenge 2019", + "challengeId": 2019, + "detailedRequirements": "software detail requirement", + "projectId": 2019 + }, + { + "challengeType": "RIA Component", + "challengeName": "ACTIVE Software Challenge 2020", + "challengeId": 2020, + "detailedRequirements": "software detail requirement", + "projectId": 2020 + }, + { + "challengeType": "Development", + "challengeName": "OPEN Software Challenge 2021", + "challengeId": 2021, + "detailedRequirements": "software detail requirement", + "projectId": 2021 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2022", + "challengeId": 2022, + "detailedRequirements": "software detail requirement", + "projectId": 2022 + }, + { + "challengeType": "Content Creation", + "challengeName": "OPEN Software Challenge 2023", + "challengeId": 2023, + "detailedRequirements": "software detail requirement", + "projectId": 2023 + }, + { + "challengeType": "Test Suites", + "challengeName": "OPEN Software Challenge 2024", + "challengeId": 2024, + "detailedRequirements": "software detail requirement", + "projectId": 2024 + }, + { + "challengeType": "Architecture", + "challengeName": "OPEN Software Challenge 2025", + "challengeId": 2025, + "detailedRequirements": "software detail requirement", + "projectId": 2025 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2026", + "challengeId": 2026, + "detailedRequirements": "software detail requirement", + "projectId": 2026 + }, + { + "challengeType": "Code", + "challengeName": "OPEN Software Challenge 2027", + "challengeId": 2027, + "detailedRequirements": "software detail requirement", + "projectId": 2027 + }, + { + "challengeType": "Conceptualization", + "challengeName": "OPEN Software Challenge 2028", + "challengeId": 2028, + "detailedRequirements": "software detail requirement", + "projectId": 2028 + }, + { + "challengeType": "Reporting", + "challengeName": "OPEN Software Challenge 2029", + "challengeId": 2029, + "detailedRequirements": "software detail requirement", + "projectId": 2029 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2030", + "challengeId": 2030, + "detailedRequirements": "software detail requirement", + "projectId": 2030 + }, + { + "challengeType": "Architecture", + "challengeName": "OPEN Software Challenge 2031", + "challengeId": 2031, + "detailedRequirements": "software detail requirement", + "projectId": 2031 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2032", + "challengeId": 2032, + "detailedRequirements": "software detail requirement", + "projectId": 2032 + }, + { + "challengeType": "First2Finish", + "challengeName": "OPEN Software Challenge 2033", + "challengeId": 2033, + "detailedRequirements": "software detail requirement", + "projectId": 2033 + }, + { + "challengeType": "Reporting", + "challengeName": "OPEN Software Challenge 2034", + "challengeId": 2034, + "detailedRequirements": "software detail requirement", + "projectId": 2034 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2035", + "challengeId": 2035, + "detailedRequirements": "software detail requirement", + "projectId": 2035 + }, + { + "challengeType": "Test Suites", + "challengeName": "OPEN Software Challenge 2036", + "challengeId": 2036, + "detailedRequirements": "software detail requirement", + "projectId": 2036 + }, + { + "challengeType": "RIA Build", + "challengeName": "OPEN Software Challenge 2037", + "challengeId": 2037, + "detailedRequirements": "software detail requirement", + "projectId": 2037 + }, + { + "challengeType": "Development", + "challengeName": "OPEN Software Challenge 2038", + "challengeId": 2038, + "detailedRequirements": "software detail requirement", + "projectId": 2038 + }, + { + "challengeType": "RIA Build", + "challengeName": "OPEN Software Challenge 2039", + "challengeId": 2039, + "detailedRequirements": "software detail requirement", + "projectId": 2039 + }, + { + "challengeType": "Test Scenarios", + "challengeName": "OPEN Software Challenge 2040", + "challengeId": 2040, + "detailedRequirements": "software detail requirement", + "projectId": 2040 + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2006", + "challengeId": 2006, + "detailedRequirements": "Test Active marathon contest 2006" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2010", + "challengeId": 2010, + "detailedRequirements": "Test Active marathon contest 2010" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2015", + "challengeId": 2015, + "detailedRequirements": "Test Active marathon contest 2015" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2011", + "challengeId": 2011, + "detailedRequirements": "Test Active marathon contest 2011" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2016", + "challengeId": 2016, + "detailedRequirements": "Test Active marathon contest 2016" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2018", + "challengeId": 2018, + "detailedRequirements": "Test Active marathon contest 2018" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2019", + "challengeId": 2019, + "detailedRequirements": "Test Active marathon contest 2019" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2002", + "challengeId": 2002, + "detailedRequirements": "Test Active marathon contest 2002" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2005", + "challengeId": 2005, + "detailedRequirements": "Test Active marathon contest 2005" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2008", + "challengeId": 2008, + "detailedRequirements": "Test Active marathon contest 2008" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2012", + "challengeId": 2012, + "detailedRequirements": "Test Active marathon contest 2012" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2017", + "challengeId": 2017, + "detailedRequirements": "Test Active marathon contest 2017" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2001", + "challengeId": 2001, + "detailedRequirements": "Test Active marathon contest 2001" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2003", + "challengeId": 2003, + "detailedRequirements": "Test Active marathon contest 2003" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2004", + "challengeId": 2004, + "detailedRequirements": "Test Active marathon contest 2004" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2007", + "challengeId": 2007, + "detailedRequirements": "Test Active marathon contest 2007" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2009", + "challengeId": 2009, + "detailedRequirements": "Test Active marathon contest 2009" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2013", + "challengeId": 2013, + "detailedRequirements": "Test Active marathon contest 2013" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2014", + "challengeId": 2014, + "detailedRequirements": "Test Active marathon contest 2014" + }, + { + "challengeType": "marathon", + "challengeName": "Test Active marathon contest 2020", + "challengeId": 2020, + "detailedRequirements": "Test Active marathon contest 2020" + } + ], + "total": 100 +} diff --git a/test/test_files/expected_get_challenge_rss_design_open.json b/test/test_files/expected_get_challenge_rss_design_open.json new file mode 100644 index 000000000..7c7769f17 --- /dev/null +++ b/test/test_files/expected_get_challenge_rss_design_open.json @@ -0,0 +1,145 @@ +{ + "data": [ + { + "challengeType": "Print/Presentation", + "challengeName": "OPEN Studio Challenge 2101", + "challengeId": 2101, + "detailedRequirements": "", + "projectId": 2101 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "OPEN Studio Challenge 2102", + "challengeId": 2102, + "detailedRequirements": "", + "projectId": 2102 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2103", + "challengeId": 2103, + "detailedRequirements": "", + "projectId": 2103 + }, + { + "challengeType": "Wireframes", + "challengeName": "OPEN Studio Challenge 2104", + "challengeId": 2104, + "detailedRequirements": "", + "projectId": 2104 + }, + { + "challengeType": "Wireframes", + "challengeName": "OPEN Studio Challenge 2105", + "challengeId": 2105, + "detailedRequirements": "", + "projectId": 2105 + }, + { + "challengeType": "Wireframes", + "challengeName": "OPEN Studio Challenge 2106", + "challengeId": 2106, + "detailedRequirements": "", + "projectId": 2106 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2107", + "challengeId": 2107, + "detailedRequirements": "", + "projectId": 2107 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2108", + "challengeId": 2108, + "detailedRequirements": "", + "projectId": 2108 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "OPEN Studio Challenge 2109", + "challengeId": 2109, + "detailedRequirements": "", + "projectId": 2109 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2110", + "challengeId": 2110, + "detailedRequirements": "", + "projectId": 2110 + }, + { + "challengeType": "Idea Generation", + "challengeName": "OPEN Studio Challenge 2111", + "challengeId": 2111, + "detailedRequirements": "", + "projectId": 2111 + }, + { + "challengeType": "Front-End Flash", + "challengeName": "OPEN Studio Challenge 2112", + "challengeId": 2112, + "detailedRequirements": "", + "projectId": 2112 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2113", + "challengeId": 2113, + "detailedRequirements": "", + "projectId": 2113 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2114", + "challengeId": 2114, + "detailedRequirements": "", + "projectId": 2114 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "OPEN Studio Challenge 2115", + "challengeId": 2115, + "detailedRequirements": "", + "projectId": 2115 + }, + { + "challengeType": "Logo Design", + "challengeName": "OPEN Studio Challenge 2116", + "challengeId": 2116, + "detailedRequirements": "", + "projectId": 2116 + }, + { + "challengeType": "Idea Generation", + "challengeName": "OPEN Studio Challenge 2117", + "challengeId": 2117, + "detailedRequirements": "", + "projectId": 2117 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "OPEN Studio Challenge 2118", + "challengeId": 2118, + "detailedRequirements": "", + "projectId": 2118 + }, + { + "challengeType": "Front-End Flash", + "challengeName": "OPEN Studio Challenge 2119", + "challengeId": 2119, + "detailedRequirements": "", + "projectId": 2119 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "OPEN Studio Challenge 2120", + "challengeId": 2120, + "detailedRequirements": "", + "projectId": 2120 + } + ], + "total": 20 +} diff --git a/test/test_files/expected_get_challenge_rss_develop_open.json b/test/test_files/expected_get_challenge_rss_develop_open.json new file mode 100644 index 000000000..e299ba9ef --- /dev/null +++ b/test/test_files/expected_get_challenge_rss_develop_open.json @@ -0,0 +1,145 @@ +{ + "data": [ + { + "challengeType": "Development", + "challengeName": "OPEN Software Challenge 2021", + "challengeId": 2021, + "detailedRequirements": "software detail requirement", + "projectId": 2021 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2022", + "challengeId": 2022, + "detailedRequirements": "software detail requirement", + "projectId": 2022 + }, + { + "challengeType": "Content Creation", + "challengeName": "OPEN Software Challenge 2023", + "challengeId": 2023, + "detailedRequirements": "software detail requirement", + "projectId": 2023 + }, + { + "challengeType": "Test Suites", + "challengeName": "OPEN Software Challenge 2024", + "challengeId": 2024, + "detailedRequirements": "software detail requirement", + "projectId": 2024 + }, + { + "challengeType": "Architecture", + "challengeName": "OPEN Software Challenge 2025", + "challengeId": 2025, + "detailedRequirements": "software detail requirement", + "projectId": 2025 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2026", + "challengeId": 2026, + "detailedRequirements": "software detail requirement", + "projectId": 2026 + }, + { + "challengeType": "Code", + "challengeName": "OPEN Software Challenge 2027", + "challengeId": 2027, + "detailedRequirements": "software detail requirement", + "projectId": 2027 + }, + { + "challengeType": "Conceptualization", + "challengeName": "OPEN Software Challenge 2028", + "challengeId": 2028, + "detailedRequirements": "software detail requirement", + "projectId": 2028 + }, + { + "challengeType": "Reporting", + "challengeName": "OPEN Software Challenge 2029", + "challengeId": 2029, + "detailedRequirements": "software detail requirement", + "projectId": 2029 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2030", + "challengeId": 2030, + "detailedRequirements": "software detail requirement", + "projectId": 2030 + }, + { + "challengeType": "Architecture", + "challengeName": "OPEN Software Challenge 2031", + "challengeId": 2031, + "detailedRequirements": "software detail requirement", + "projectId": 2031 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2032", + "challengeId": 2032, + "detailedRequirements": "software detail requirement", + "projectId": 2032 + }, + { + "challengeType": "First2Finish", + "challengeName": "OPEN Software Challenge 2033", + "challengeId": 2033, + "detailedRequirements": "software detail requirement", + "projectId": 2033 + }, + { + "challengeType": "Reporting", + "challengeName": "OPEN Software Challenge 2034", + "challengeId": 2034, + "detailedRequirements": "software detail requirement", + "projectId": 2034 + }, + { + "challengeType": "RIA Component", + "challengeName": "OPEN Software Challenge 2035", + "challengeId": 2035, + "detailedRequirements": "software detail requirement", + "projectId": 2035 + }, + { + "challengeType": "Test Suites", + "challengeName": "OPEN Software Challenge 2036", + "challengeId": 2036, + "detailedRequirements": "software detail requirement", + "projectId": 2036 + }, + { + "challengeType": "RIA Build", + "challengeName": "OPEN Software Challenge 2037", + "challengeId": 2037, + "detailedRequirements": "software detail requirement", + "projectId": 2037 + }, + { + "challengeType": "Development", + "challengeName": "OPEN Software Challenge 2038", + "challengeId": 2038, + "detailedRequirements": "software detail requirement", + "projectId": 2038 + }, + { + "challengeType": "RIA Build", + "challengeName": "OPEN Software Challenge 2039", + "challengeId": 2039, + "detailedRequirements": "software detail requirement", + "projectId": 2039 + }, + { + "challengeType": "Test Scenarios", + "challengeName": "OPEN Software Challenge 2040", + "challengeId": 2040, + "detailedRequirements": "software detail requirement", + "projectId": 2040 + } + ], + "total": 20 +} diff --git a/test/test_files/expected_get_challenge_rss_upcoming.json b/test/test_files/expected_get_challenge_rss_upcoming.json new file mode 100644 index 000000000..a6350d919 --- /dev/null +++ b/test/test_files/expected_get_challenge_rss_upcoming.json @@ -0,0 +1,285 @@ +{ + "data": [ + { + "challengeType": "Application Front-End Design", + "challengeName": "UPCOMING Studio Challenge 2121", + "challengeId": 2121, + "detailedRequirements": "", + "projectId": 2121 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "UPCOMING Studio Challenge 2122", + "challengeId": 2122, + "detailedRequirements": "", + "projectId": 2122 + }, + { + "challengeType": "Logo Design", + "challengeName": "UPCOMING Studio Challenge 2123", + "challengeId": 2123, + "detailedRequirements": "", + "projectId": 2123 + }, + { + "challengeType": "Application Front-End Design", + "challengeName": "UPCOMING Studio Challenge 2124", + "challengeId": 2124, + "detailedRequirements": "", + "projectId": 2124 + }, + { + "challengeType": "Logo Design", + "challengeName": "UPCOMING Studio Challenge 2125", + "challengeId": 2125, + "detailedRequirements": "", + "projectId": 2125 + }, + { + "challengeType": "Web Design", + "challengeName": "UPCOMING Studio Challenge 2126", + "challengeId": 2126, + "detailedRequirements": "", + "projectId": 2126 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "UPCOMING Studio Challenge 2127", + "challengeId": 2127, + "detailedRequirements": "", + "projectId": 2127 + }, + { + "challengeType": "Idea Generation", + "challengeName": "UPCOMING Studio Challenge 2128", + "challengeId": 2128, + "detailedRequirements": "", + "projectId": 2128 + }, + { + "challengeType": "Wireframes", + "challengeName": "UPCOMING Studio Challenge 2129", + "challengeId": 2129, + "detailedRequirements": "", + "projectId": 2129 + }, + { + "challengeType": "Other", + "challengeName": "UPCOMING Studio Challenge 2130", + "challengeId": 2130, + "detailedRequirements": "", + "projectId": 2130 + }, + { + "challengeType": "Web Design", + "challengeName": "UPCOMING Studio Challenge 2131", + "challengeId": 2131, + "detailedRequirements": "", + "projectId": 2131 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "UPCOMING Studio Challenge 2132", + "challengeId": 2132, + "detailedRequirements": "", + "projectId": 2132 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "UPCOMING Studio Challenge 2133", + "challengeId": 2133, + "detailedRequirements": "", + "projectId": 2133 + }, + { + "challengeType": "Widget or Mobile Screen Design", + "challengeName": "UPCOMING Studio Challenge 2134", + "challengeId": 2134, + "detailedRequirements": "", + "projectId": 2134 + }, + { + "challengeType": "Other", + "challengeName": "UPCOMING Studio Challenge 2135", + "challengeId": 2135, + "detailedRequirements": "", + "projectId": 2135 + }, + { + "challengeType": "Wireframes", + "challengeName": "UPCOMING Studio Challenge 2136", + "challengeId": 2136, + "detailedRequirements": "", + "projectId": 2136 + }, + { + "challengeType": "Other", + "challengeName": "UPCOMING Studio Challenge 2137", + "challengeId": 2137, + "detailedRequirements": "", + "projectId": 2137 + }, + { + "challengeType": "Print/Presentation", + "challengeName": "UPCOMING Studio Challenge 2138", + "challengeId": 2138, + "detailedRequirements": "", + "projectId": 2138 + }, + { + "challengeType": "Wireframes", + "challengeName": "UPCOMING Studio Challenge 2139", + "challengeId": 2139, + "detailedRequirements": "", + "projectId": 2139 + }, + { + "challengeType": "Banners/Icons", + "challengeName": "UPCOMING Studio Challenge 2140", + "challengeId": 2140, + "detailedRequirements": "", + "projectId": 2140 + }, + { + "challengeType": "RIA Component", + "challengeName": "UPCOMING Software Challenge 2041", + "challengeId": 2041, + "detailedRequirements": "software detail requirement", + "projectId": 2041 + }, + { + "challengeType": "UI Prototypes", + "challengeName": "UPCOMING Software Challenge 2042", + "challengeId": 2042, + "detailedRequirements": "software detail requirement", + "projectId": 2042 + }, + { + "challengeType": "UI Prototypes", + "challengeName": "UPCOMING Software Challenge 2043", + "challengeId": 2043, + "detailedRequirements": "software detail requirement", + "projectId": 2043 + }, + { + "challengeType": "Design", + "challengeName": "UPCOMING Software Challenge 2044", + "challengeId": 2044, + "detailedRequirements": "software detail requirement", + "projectId": 2044 + }, + { + "challengeType": "Development", + "challengeName": "UPCOMING Software Challenge 2045", + "challengeId": 2045, + "detailedRequirements": "software detail requirement", + "projectId": 2045 + }, + { + "challengeType": "RIA Build", + "challengeName": "UPCOMING Software Challenge 2046", + "challengeId": 2046, + "detailedRequirements": "software detail requirement", + "projectId": 2046 + }, + { + "challengeType": "Assembly Competition", + "challengeName": "UPCOMING Software Challenge 2047", + "challengeId": 2047, + "detailedRequirements": "software detail requirement", + "projectId": 2047 + }, + { + "challengeType": "Test Suites", + "challengeName": "UPCOMING Software Challenge 2048", + "challengeId": 2048, + "detailedRequirements": "software detail requirement", + "projectId": 2048 + }, + { + "challengeType": "Code", + "challengeName": "UPCOMING Software Challenge 2049", + "challengeId": 2049, + "detailedRequirements": "software detail requirement", + "projectId": 2049 + }, + { + "challengeType": "UI Prototypes", + "challengeName": "UPCOMING Software Challenge 2050", + "challengeId": 2050, + "detailedRequirements": "software detail requirement", + "projectId": 2050 + }, + { + "challengeType": "Bug Hunt", + "challengeName": "UPCOMING Software Challenge 2051", + "challengeId": 2051, + "detailedRequirements": "software detail requirement", + "projectId": 2051 + }, + { + "challengeType": "Bug Hunt", + "challengeName": "UPCOMING Software Challenge 2052", + "challengeId": 2052, + "detailedRequirements": "software detail requirement", + "projectId": 2052 + }, + { + "challengeType": "Reporting", + "challengeName": "UPCOMING Software Challenge 2053", + "challengeId": 2053, + "detailedRequirements": "software detail requirement", + "projectId": 2053 + }, + { + "challengeType": "Specification", + "challengeName": "UPCOMING Software Challenge 2054", + "challengeId": 2054, + "detailedRequirements": "software detail requirement", + "projectId": 2054 + }, + { + "challengeType": "Development", + "challengeName": "UPCOMING Software Challenge 2055", + "challengeId": 2055, + "detailedRequirements": "software detail requirement", + "projectId": 2055 + }, + { + "challengeType": "Specification", + "challengeName": "UPCOMING Software Challenge 2056", + "challengeId": 2056, + "detailedRequirements": "software detail requirement", + "projectId": 2056 + }, + { + "challengeType": "Development", + "challengeName": "UPCOMING Software Challenge 2057", + "challengeId": 2057, + "detailedRequirements": "software detail requirement", + "projectId": 2057 + }, + { + "challengeType": "Test Scenarios", + "challengeName": "UPCOMING Software Challenge 2058", + "challengeId": 2058, + "detailedRequirements": "software detail requirement", + "projectId": 2058 + }, + { + "challengeType": "Assembly Competition", + "challengeName": "UPCOMING Software Challenge 2059", + "challengeId": 2059, + "detailedRequirements": "software detail requirement", + "projectId": 2059 + }, + { + "challengeType": "UI Prototypes", + "challengeName": "UPCOMING Software Challenge 2060", + "challengeId": 2060, + "detailedRequirements": "software detail requirement", + "projectId": 2060 + } + ], + "total": 40 +} diff --git a/test/test_files/expected_get_challenges_rss_error_message.json b/test/test_files/expected_get_challenges_rss_error_message.json new file mode 100644 index 000000000..06ec12373 --- /dev/null +++ b/test/test_files/expected_get_challenges_rss_error_message.json @@ -0,0 +1,8 @@ +{ + "challengeType": { + "invalid": "challengeType should be an element of develop,design,data." + }, + "listType": { + "invalid": "listType should be an element of ACTIVE,OPEN,UPCOMING,PAST." + } +} diff --git a/test/test_files/expected_marathon_reg_info.json b/test/test_files/expected_marathon_reg_info.json new file mode 100755 index 000000000..1a1961473 --- /dev/null +++ b/test/test_files/expected_marathon_reg_info.json @@ -0,0 +1,62 @@ +{ + "term": { + "contestName": "Marathon Match 90", + "roundName": "Round 2001", + "termsContent": "Marathon Match terms content" + }, + "questions": [ + { + "id": 1000, + "style": "Multiple Choice", + "type": "Elligble", + "text": "question 1000", + "answers": [ + { + "id": 1002, + "text": "answer text 1", + "sortOrder": 1, + "correct": true + }, + { + "id": 1001, + "text": "answer text 2", + "sortOrder": 2, + "correct": false + }, + { + "id": 1003, + "text": "answer text 3", + "sortOrder": 3, + "correct": false + } + ] + }, + { + "id": 1001, + "style": "Short Answer", + "type": "Personal", + "text": "question 1001", + "answers": [] + }, + { + "id": 1002, + "style": "Single Choice", + "type": "Elligble", + "text": "question 1002", + "answers": [ + { + "id": 1004, + "text": "answer text 4", + "sortOrder": -1, + "correct": false + }, + { + "id": 1005, + "text": "answer text 5", + "sortOrder": 1, + "correct": true + } + ] + } + ] +} \ No newline at end of file diff --git a/test/test_files/expected_marathon_reg_info_empty_questions.json b/test/test_files/expected_marathon_reg_info_empty_questions.json new file mode 100755 index 000000000..2191f8339 --- /dev/null +++ b/test/test_files/expected_marathon_reg_info_empty_questions.json @@ -0,0 +1,8 @@ +{ + "term": { + "contestName": "Marathon Match 91", + "roundName": "Test Round 2006", + "termsContent": "Marathon Match terms content" + }, + "questions": [] +} \ No newline at end of file diff --git a/test/test_files/exptected_member_register_validate_user.txt b/test/test_files/exptected_member_register_validate_user.txt index 15fd79949..7f8e45a1b 100644 --- a/test/test_files/exptected_member_register_validate_user.txt +++ b/test/test_files/exptected_member_register_validate_user.txt @@ -3,5 +3,8 @@ "first_name": "foo", "handle": "testHandleFoo", "status": "U", - "last_name": "bar" + "last_name": "bar", + "utm_source": "some source", + "utm_medium": "some medium", + "utm_campaign": "some campaign" } 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 +}