Git Product home page Git Product logo

treasures-and-trinkets's Introduction

Treasures and Trinkets Project

Melanie Vera's shop, Treasures and Trinkets, is taking off! Since starting her store 5 years ago, she's now opened in multiple locations and is moving into online and telesales. In her store, she sells "Treasure Boxes," which are gift boxes with a special theme. She packages these boxes and then sends them out via the mail.

Example of a treasure box.
Image from Port Gamble General Store.

Melanie wants you to help her improve her business by analyzing the customer data from the store. She would like to do things like:

  • Get all the customer emails so she can send out thank you messages.
  • Get all the customer names so she can customize her thank you emails.
  • Count how many treasure boxes she’s sold.
  • Figure out how much revenue has been made.
  • Learn which treasure box that was sold is the most expensive.
  • Figure out which state has the most customers.
  • Learn which sales associate has made the most sales.

Below, you will see a complete list of the functions Melanie would like you to build.

This is the second project of the course. Please read carefully through the instructions and rubric below.

Project scoring

This project has two different parts on which you will be graded. Each part is weighted differently.

  • 70% of the project is scored on completion.
  • 30% of the project is scored through the mastery rubric.

In total, you must receive at least 70% to complete this project. For example, you could attain 60% of points through the completion requirements and 10% of points through the mastery rubric.

Completion

Each function you complete within the three files located in the src/ folder must be completed in full. If the function you write passes all of the tests, you will receive full credit. If your function passes some of the tests, you will receive partial credit.

If you get stuck on a particular function, feel free to move on to another function and return to it at a later time.

Collect

Build functions to collect some helpful information.

  1. Complete the getAllCustomerEmails() function.
  2. Complete the getAllCustomerFullNames() function.
  3. Complete the getCountOfAllCustomerTransactions() function.
  4. Complete the getUniqueListOfAllCustomerStates() function.
  5. Complete the getCountOfAllProductsPurchased() function.
  6. Complete the getTotalRevenueOfAllProductsSold() function.
  7. Complete the getUniqueListOfAllAssociateStoreLocations() function.
  8. Complete the getMostExpensiveTreasureBox() function.

Find

All of these functions use parameters to find specific data.

  1. Complete the findCustomerById() function.
  2. Complete the findCustomerByFullName() function.
  3. Complete the findAssociateById() function.
  4. Complete the findAllCustomersByState() function.
  5. Complete the findAllCustomersHelpedByAssociate() function.
  6. Complete the findAllCustomersWhoBoughtSpecificBox() function.

Transform

All of these functions rework the existing data into a new shape. Transformations are important in coding as they can help answer a broader range of questions. For example, even though the data you are given is by customer, you can reshape the data to be by associate or by product.

  1. Complete the transformToAssociateByIdAndSaleTotal() function.
  2. Complete the transformToAssociateByIdWithTransactionIds() function.
  3. Complete the transformToAssociateByIdAndCustomerMiniProfile() function.
  4. Complete the transformToProductByNameAndCustomerMiniProfile() function.

Mastery rubric

Beyond getting the tests to pass, you must build your skills to write good code that follows best practices. To view components of the mastery rubric, view the appropriate assignment on Canvas.

Existing data

The data/data.json file contains the data used by the functions. This data is used in the tests. If you'd like, you can also copy this data to the index.js file and assign it to a variable. You can then test out your functions in the index.js file by following the instructions there.

All of the functions search through the existing data in the data/data.json. You can open this file and look at the data at any time.

The data is an array of objects. Each object represents a customer.

The object has the following keys:

  • id: (string) A unique identifier for the customer.
  • email: (string) The customer's unique email address.
  • username: (string) The customer's unique username.
  • profile: (object) Represents personal information about the customer.
    • name: (object)
      • first: (string) The customer's first name.
      • last: (string) The customer's surname.
  • company: (string) The customer's employer.
  • dob: (string) The customer's date of birth in the format yyyy-mm-dd.
  • address: (object) Represents the customer's overall address.
    • line1: (string) The customer's street address.
    • line2: (string) The customer's apartment or unit number, if applicable.
    • city: (string) The customer's city.
    • state: (string) The customer's state.
  • transactions: (array of objects) Represents a single transaction the customer made.
    • id: (string) A unique identifier for the transaction.
    • products: (array of objects) All products sold within the transaction.
      • id` (string) A unique identifier for the product.
      • productName: (string) The name of the treasure box product.
      • priceInCents: (number) The cost of the treasure box in cents.
    • associate: (object) The associate who helped with the transaction.
      • id: (string) A unique identifier for the associate.
      • email: (string) The associate's company email.
      • storeLocation: (string) The city and state where the associate is located.
      • name: (object)
        • first: (string) The associate's first name.
        • last: (string) The associate's surname.
      • dob: (string) The associate's date of birth in the format yyyy-mm-dd.

Run the tests

If you press the "Run" button on Replit, all of the tests will run for this project. However, there are many tests in this project, so you may find it difficult to understand the test output if you run all of the tests.

Instead of pressing the green "Run" button, change to the tab that says "Shell". You will see a command line interface. If you wish to run the tests for a single file, you will need to use this interface while following the instructions below.

Run a single test file

While in the "Shell" interface, type the following and then press the "Enter" key.

npm test 01

You should see the tests run, as you are used to seeing. However, if you scroll up to the top of the output, you should see that only the __tests__/01-search.test.js file ran.

You can replace 01 with the number of your test file. For example, if you want to run the tests for 03-transform.js file, you can run the following command:

npm test 03

treasures-and-trinkets's People

Contributors

jdrichards-pursuit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.