Skip to content

Commit

Permalink
Tweak ranking
Browse files Browse the repository at this point in the history
  • Loading branch information
dominic-codespoti committed Aug 31, 2024
1 parent b63e2b0 commit 96a12f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Song Ranking App
# Song Ranker

## Overview

Expand Down Expand Up @@ -33,14 +33,3 @@ npm start
```

Navigate to `http://localhost:3000` in your web browser to access the app.

## Acceptance Criteria

1. **Initial Display**: When the app opens, two random songs from a predefined set are displayed, and users can select between four options: Selection 1, Selection 2, Equal, and No Opinion.
2. **Song Ranking**: Clicking on a song ranks it higher than the other option.
3. **Repetition**: New songs are shown repeatedly until they are correctly positioned in the ranking.
4. **Equal Ranking**: Clicking on "Equal" ranks the two compared songs equally.
5. **No Opinion**: Clicking on "No Opinion" ranks the song last.
6. **Completion**: The process repeats until all songs are ranked.
7. **Final Rankings**: Displays a list of all songs in ranked order.
8. **Album Rankings**: Shows rankings based on albums in a separate list below the final song rankings.
6 changes: 3 additions & 3 deletions src/ranker/ranker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const Ranker: React.FC<Props> = ({ artistName, limit = 10 }) => {
currentSong: secondSong,
comparisonSong: firstSong,
remainingSongs: restSongs,
rankedSongs: [firstSong],
rankedSongs: [],
lowerBound: 0,
upperBound: 1, // Initialize upperBound to 1 as we start with one ranked song
});
Expand Down Expand Up @@ -117,9 +117,9 @@ export const Ranker: React.FC<Props> = ({ artistName, limit = 10 }) => {
let newLowerBound = lowerBound;
let newUpperBound = upperBound;

if (preference === "First") {
if (preference === "Second") {
newLowerBound = Math.floor((lowerBound + upperBound) / 2);
} else if (preference === "Second") {
} else if (preference === "First") {
newUpperBound = Math.floor((lowerBound + upperBound) / 2);
} else if (preference === "Equal") {
// Insert at the current position
Expand Down

0 comments on commit 96a12f1

Please sign in to comment.