Key Information

Register
Submit
The challenge is finished.

Challenge Overview

Cloud Hub is looking to refactor an endpoint for our category reporting. This endpoint returns all of the apps a company has spent money on and groups them by category. We want to expand this endpoint to also group apps by subcategory. An example data structure is below, but the numbers are not accurate and are just placeholders.

Current structure:

{
    "category": "Marketing",
    "spend": 775982.01,
    "apps": [{
        "company_app_id": "48a393cf-d4cf-4c33-8621-a7eb370972ca",
        "app_id": "2e043679-f764-47e0-afc3-ee39c51a2033",
        "app_label": "Adobe Campaign",
        "app_domain": "adobe.com",
        "spend": 176987
    }]
}

New structure:
{
    "category": "Marketing",
    "spend": 775982.01,
    "subcategory": [{
        "subcategory": "Email Marketing",
        "spend": 123456789,
        "apps": [{
            "company_app_id": "48a393cf-d4cf-4c33-8621-a7eb370972ca",
            "app_id": "2e043679-f764-47e0-afc3-ee39c51a2033",
            "app_label": "Adobe Campaign",
            "app_domain": "adobe.com",
            "spend": 176987
        }]
    }]
}

Requirements
1. Update companyAppService.getTopSpendCategories to group by companyapps.subcategory too.
2. subcategory.spend should be the total spend for any apps with that same subcategory, this is the same as category spend.
3. Update tests to reflect new structure and validate summary is working correctly.
 

Final Submission Guidelines

1. Any additions or modifications to the code project pass on "npm run lint". Any modifications to the base project needs to pass the tests, npm run test.
2. Please include a git patch for easier integration of changes.
3. The bulk of your documentation should be in the Readme.md and you should assume that this will be open source so make sure you cover all the steps to set up,  If you have specific information that should not be included in a public readme (like links to your video) put them in a file called submission.txt and they will be omitted from the project if it is open sourced.

ELIGIBLE EVENTS:

2017 TopCoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30055586