Skip to content

albertchitta/ASSIGNMENT-Bear-Watcher

 
 

Repository files navigation

Bear Watcher Netlify Status

Each year between July and September brown bears in the Katmai National Park congregate along the Brooks River. This river is one of the main rivers that Sockeye Salmon swim up to spawn. The brown bears wait in the shallows of the river and catch the salmon as they jump over rocks.

View App

Get Started

$ git clone git@github.com:albertchitta/ASSIGNMENT-Bear-Watcher.git
$ cd ASSIGNMENT-Bear-Watcher

About the User

  • The ideal users for this site are scientists and park rangers who can use it to track these bears.

Features

  • The DOM will populate a welcome message, followed by a form to enter a bear name and image url for a new bear.
  • The DOM will then populate with a card of bears from the array.
  • Catch Attempt: A button is used to track the number of catch attempts with a time stamp.
  • Successful Catches: A button is used to track the number of successful catches with a time stamp.
  • Fattest Bear Award: Each year in early september one bear is awarded the Fattest Bear award. This award goes to the bear who gains the most weight between July and September.

Video Walkthrough of Bear Watcher

https://www.loom.com/share/ee9a427632d64b2c925d6337baf486d4

Relevant Links

Code Snippet

This function compares the number of successfully caught fishes between the bears, sorting them from highest to lowest.

const compareCatches = (array) => {
  const sortedArray = array.slice().sort((a, b) => b.catches - a.catches);

  const awardedBears = [];

  for (let i = 0; sortedArray[i].catches > 0 && i < 3; i += 1) {
    if (i === 0) {
      sortedArray[i].award = 'gold';
      awardedBears.push(sortedArray[i]);
    }
    if (i === 1) {
      sortedArray[i].award = 'silver';
      if (sortedArray[i].catches === sortedArray[i - 1].catches) {
        sortedArray[i].award = 'gold';
      }
      awardedBears.push(sortedArray[i]);
    }
    if (i === 2) {
      sortedArray[i].award = 'bronze';
      if (sortedArray[i].catches === sortedArray[i - 1].catches || sortedArray[i - 1].award === 'gold') {
        sortedArray[i].award = 'silver';
      }
      awardedBears.push(sortedArray[i]);
    }

    fattestBear(awardedBears);
  }
};

Project Screenshots

Bear_Watcher_Overview Bear_Watcher_River

Contributors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 86.9%
  • SCSS 8.7%
  • HTML 3.1%
  • Shell 1.3%