Challenge Overview

Project Overview

TopCoder and the TopCoder community have worked hard to get the platform to its currently level of maturity, but we're far from done. It's time to take the platform to the next level. TopCoder is going to start taking some steps to open up the platform API to the outside and community developers so they could incorporate it in their websites, applications or build their own applications (web, mobile or desktop).

The ultimate goal is to open up and build an "API" that is targeting all different type of audiences - Software and Studio Competitors, SRM/MM competitors, Copilots, Admins and TopCoder partners - each audience will have different interests and usages of the API, so it will be a huge project and we need to make sure that we are in the right direction from the beginning.

Competition Task Overview

The updated code must still deploy and work on heroku - any submission which can't be deployed on heroku successfully will be failed in screening phase - primary reviewer must check this.

The implementation will base on the node.js version of TC platform API - https://github.com/cloudspokes/tc-api. Please follow the existing actionhero pattern for your development.

THIS IS 72HOURS CONTEST

You should implement the Client Challenge Costs API and provide mocha tests in this contest.

Client Challenge Costs API

This API is going to retrieve the Client Challenge Costs History by the given date and/or client Id.

It needs to pass at least one parameter (client id or start date + end date)

The parameters are given in the API Spec page.

This API should only allow "TC Staff" access it, you can get the authencated user role from authentication middleware.

Here is the query:

SELECT
      c.client_id AS customer_id,
      c.client_name AS customer_name,
      p.project_id AS direct_project_id,
      d.name AS project_name,
      p.project_category_name AS challenge_type,
      p.component_name AS challenge_name,
      p.posting_date  AS posting_date,
      p.complete_date AS completion_date,
      nvl(p.fulfillment, 0)*100 AS challenge_fulfillment,
      nvl(p.contest_prizes_total, 0) AS challenge_member_cost,
      nvl(p.admin_fee, 0) AS challenge_fee,
      nvl(p.contest_prizes_total, 0) + nvl(p.admin_fee, 0) AS challenge_total_cost,
      ROUND (nvl(p.duration, 0)/(60*24), 2)  AS challenge_duration,
      p.status_desc AS challenge_status
FROM tcs_dw:project p
INNER JOIN tcs_dw:client_project_dim c ON p.client_project_id = c.client_project_id
INNER JOIN tcs_dw:direct_project_dim d ON p.tc_direct_project_id = d.direct_project_id
WHERE p.complete_date is not null AND p.posting_date is not null
AND Date(p.complete_date) BETWEEN TO_DATE('@sdt@', '%Y-%m-%d') AND TO_DATE('@edt@', '%Y-%m-%d')
 
AND   c.client_id = DECODE(@clientid@, 0, c.client_id, @clientid@)
AND p.status_id in (4, 5, 6, 7, 8, 11)
AND p.project_category_id not in (29)

Standarize Query Naming Convension

we like to use the underscore approach in all SQL queries under the queries directory, please follow same approach.

Notes, for the JSON data returned, we will use camelCase approach.

Testing

The API Framework supports tests. Use supertest with mocha. Don't install mocha globally.

you must use mocha BDD style (which is the default), within that, you can optionally use chai.

Note: Tests must follow this standard - Tests Creation Guide.docx

Code Format

All code must pass jslint. You may use "nomen: true".

Winner Only

Winner will create pull request against the main github repo in final fix phase and help merge with master. The changed files should be unix style, you can use dos2unix command to convert it before commiting.

Reviewer Responsiblities

Reviewers need to write/update Supertest tests for the these APIs.

There are three roles:

  • Accuracy - Tests the implementation on the accuracy of the results when using the component.
  • Failure - Tests the implementation's ability to handle bad data and incorrect usage.
  • Security - Tests the oauth, sql inject and other security related requirements.

Reviewer could send preferred role by Contact Manager after system selected the reviwer.

Copilot will assign the role to reviewers if reviewer didn't send the preferred role information.

Reviewer must create pull request from GitHub for the tests.

Virutal Machines (VMs)

VM specific information is found here: http://www.topcoder.com/wiki/display/docs/VM+Image+2.5

Upon registration as a submitter or reviewer you will need to request a VM based on the TopCoder systems image. The VM will be active through aggregation review, after which it will be terminated except for the winner's and the reviewers'. To request your image, please post in contest forum.

Before requesting your VM, you need to ensure that you have an SSH key created and in your member profile. Instructions to do so are here: http://www.topcoder.com/wiki/display/projects/Generate+SSH+Key, and instructions to connect afterwards are here: http://www.topcoder.com/wiki/display/projects/Connect+Using+SSH+Key.

Please realize that VMs are currently issued manually. We make every attempt to issue the VM as soon as it is requested, however, there may be delays of up to 12 hours depending on time of day when you request. We encourage everyone to request a VM as soon as possible to minimize any such delays.

Technology Overview

Documentation Provided

Please check the deployment guide in codebase for reference.



Final Submission Guidelines

Submission Deliverables

A complete list of deliverables can be viewed in the TopCoder Assembly competition Tutorial at: http://apps.topcoder.com/wiki/display/tc/Assembly+Competition+Tutorials

Below is an overview of the deliverables:

  • Source Code.
  • Deployment guide to configure and verify the application.

Final Submission

For each member, the final submission should be uploaded to the Online Review Tool.

ELIGIBLE EVENTS:

2014 TopCoder(R) Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30039378