Skip to content

Commit

Permalink
updates to filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
mbogo-mit committed Nov 17, 2023
1 parent 3a3e9fc commit 7c2d02e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
47 changes: 24 additions & 23 deletions src/components/DashboardChannels/AnnotationsChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,29 @@ export default function AnnotationsChannel({
callback();
}).current;

const getDocumentFromDocuments = () => {
if (selectedGroupId && selectedDocumentId) {
const obj = documents[selectedGroupId]

for (const [key, arr] of Object.entries(obj)) {
if (Array.isArray(arr)) {
for (let d of arr) {
if (d._id === selectedDocumentId) {
return d
}
}
}

}
}

return undefined
}

const byWithGroupId = (anno) => (
getDocumentFromDocuments()?.version === 4 ? byGroupFilterMatch(anno?.creator?.withGroupId ? [anno?.creator?.withGroupId] : [], [selectedGroupId]) : true
);

const loadComponent = loadMore
? <ListLoadingSpinner />
: (
Expand Down Expand Up @@ -231,29 +254,7 @@ export default function AnnotationsChannel({
byTag: <BookmarkFill size={14} style={{ marginRight: 4 }} />,
byDateCreated: <CalendarEventFill size={14} style={{ marginRight: 4 }} />,
};

const getDocumentFromDocuments = () => {
if (selectedGroupId && selectedDocumentId) {
const obj = documents[selectedGroupId]
// console.log('obj: ', Object.entries(obj))
for (const [key, arr] of Object.entries(obj)) {
if (Array.isArray(arr)) {
for (let d of arr) {
if (d._id === selectedDocumentId) {
return d
}
}
}

}
}

return undefined
}

const byWithGroupId = (anno) => (
getDocumentFromDocuments()?.version === 4 ? byGroupFilterMatch(anno?.creator?.withGroupId ? [anno?.creator?.withGroupId] : [], [selectedGroupId]) : true
);


const buttons = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/DashboardChannels/GroupsChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function GroupsChannel({
) || []).concat(seachQueryGroups.sort(sortGroups));

// Personal Psuedo group will only be apart of the active groups not archived
console.log(rawGroupTiles);
// console.log(rawGroupTiles);
groupTiles = rawGroupTiles.map(({
id, name, memberCount, role, isPrivateGroup,
}) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/FilterPopover/FilterPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function FilterPopover({ session }) {
};

const GenerateFilterOptions = (userEmail, annotations, filters) => {
console.log('annotations: ', annotations)
// console.log('annotations: ', annotations)
// this function takes in a list of annotations and returns an object of all
// the filter options that are available for this list of annotations and how
// many matches each option has with the current filtres applied
Expand Down Expand Up @@ -222,7 +222,7 @@ function FilterPopover({ session }) {

const filterOptions = GenerateFilterOptions(session.user.email, channelAnnotations, f);

console.log('filterOptions: ', filterOptions)
// console.log('filterOptions: ', filterOptions)

const numberOfMatchesForNoTag = GetNumberOfMatchesForNoTag(channelAnnotations, f);

Expand Down

0 comments on commit 7c2d02e

Please sign in to comment.