-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update statistics to round average words
- Loading branch information
Showing
5 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import Paper from '@material-ui/core/Paper' | |
import { useSelector } from 'react-redux' | ||
import { | ||
findMostConsecutiveDays, | ||
findAverageWordCount, | ||
findAverageWordCountRounded, | ||
findLongestNote, | ||
} from 'util/notelist' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
|
@@ -25,7 +25,7 @@ export const Statistics = () => { | |
const classes = useStyles() | ||
const noteList = useSelector((state) => state.noteList) | ||
const bestStreak = findMostConsecutiveDays(noteList) | ||
const averageWordCount = findAverageWordCount(noteList) | ||
const averageWordCount = findAverageWordCountRounded(noteList) | ||
const longestNote = findLongestNote(noteList) | ||
return ( | ||
<div> | ||
|
@@ -48,15 +48,17 @@ export const Statistics = () => { | |
{`${bestStreak} ${bestStreak === 1 ? 'day' : 'days'}`} | ||
</Typography> | ||
<Typography variant="body1" gutterBottom> | ||
Average word count:{' '} | ||
{`${averageWordCount} ${ | ||
averageWordCount === 1 ? 'word' : 'words' | ||
}`} | ||
Average word count: {' '} | ||
{`${averageWordCount} ${averageWordCount === 1 ? 'word' : 'words'}`} | ||
</Typography> | ||
<Typography variant="body1" gutterBottom> | ||
Longest Note:{' '} | ||
{`${longestNote} ${longestNote === 1 ? 'word' : 'words'}`} | ||
</Typography> | ||
<br/> | ||
<Typography variant="body2"> | ||
Have an idea for other statistics? <a href="mailto:[email protected]">Shoot over an email</a> with your suggestions! | ||
</Typography> | ||
</Paper> | ||
</div> | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters