Skip to content

Commit

Permalink
sorting goals list and adding readme local run instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdevalapurkar committed Oct 20, 2021
1 parent e1d462c commit 1e0ef5a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# parakeet

🦜 An app to help your students stay motivated to practice their craft and track their progress, set new goals and work towards achieving them!

## Running Locally

This application uses Docker to run its various components. In order to spin up this application locally:

1. Clone the repository: `git clone https://github.com/sdevalapurkar/parakeet.git`.
2. From the root directory of the project, run: `docker-compose up -d`.
3. Go to `localhost:3000` and the application should be running ready to be used :)
12 changes: 11 additions & 1 deletion app/src/components/Homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ function Homepage() {
return (goalDetails.goal_practice_times * 100) / goalDetails.goal_times;
};

const sortExistingGoals = () => {
if (!existingGoals.length) {
return [];
}

return existingGoals.sort((a, b) => {
return (b.goal_times - b.goal_practice_times) - (a.goal_times - a.goal_practice_times);
});
};

const getExistingGoalsTable = () => {
if (!existingGoals.length) {
return (
Expand Down Expand Up @@ -168,7 +178,7 @@ function Homepage() {
</TableRow>
</TableHead>
<TableBody data-testid="goals-table">
{existingGoals?.map((row) => (
{sortExistingGoals().map((row) => (
<TableRow key={row.id}>
<TableCell component="th" scope="row">
<Link underline="always" component="button" variant="body2" onClick={() => history.push(`/goal/${row.id}`)}>
Expand Down

0 comments on commit 1e0ef5a

Please sign in to comment.