Skip to content

Commit

Permalink
Merge pull request #66 from Chicago-Deep-Dish/records-connection
Browse files Browse the repository at this point in the history
Records connection
  • Loading branch information
gilcohen67 authored Jul 1, 2022
2 parents 747cd35 + 73261a8 commit 5fe2682
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/RecordLibraryPage/InputFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export default function InputFields({ search, setSearch, filters, setFilters })
>
<MenuItem value="all">All Time</MenuItem>
<MenuItem value="daily">Past Day</MenuItem>
<MenuItem value="weekly">Past Week</MenuItem>
<MenuItem value="monthly">Past Month</MenuItem>
<MenuItem value="yearly">Past Year</MenuItem>
</Select>
</FormControl>
</Paper>
Expand Down
6 changes: 4 additions & 2 deletions src/components/RecordLibraryPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function RecordLibrary() {
difficulty: 'all',
timeFrame: 'all',
});

useEffect(() => {
let newData = userProblemArray.filter((prompt) => (
(prompt.promptName.includes(search) ||
Expand All @@ -25,7 +24,10 @@ export default function RecordLibrary() {
filters.difficulty === prompt.difficulty
) &&
(
filters.timeFrame === 'all'
filters.timeFrame === 'all' ||
(filters.timeFrame === 'daily' && new Date(prompt.timeStamp).getFullYear() === new Date().getFullYear() && new Date(prompt.timeStamp).getMonth() === new Date().getMonth() && new Date(prompt.timeStamp).getDate() === new Date().getDate()) ||
(filters.timeFrame === 'monthly' && new Date(prompt.timeStamp).getFullYear() === new Date().getFullYear() && new Date(prompt.timeStamp).getMonth() === new Date().getMonth()) ||
(filters.timeFrame === 'yearly' && new Date(prompt.timeStamp).getFullYear() === new Date().getFullYear())
)
));
setShownData(newData);
Expand Down

0 comments on commit 5fe2682

Please sign in to comment.