Skip to content

Commit

Permalink
Revert "Revert "fix pending counts""
Browse files Browse the repository at this point in the history
  • Loading branch information
rickjohnson authored Mar 9, 2022
1 parent 7e8480d commit b11dc30
Show file tree
Hide file tree
Showing 14 changed files with 492 additions and 481 deletions.
1 change: 1 addition & 0 deletions client/quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var path = require('path')

module.exports = function (ctx) {
return {
supportTS: true,
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://quasar.dev/quasar-cli/cli-documentation/boot-files
Expand Down
27 changes: 17 additions & 10 deletions client/src/gql/readPersonsByInstitutionByYearAllCenters.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gql from 'graphql-tag'
import _ from 'lodash'

export default function readPersonsByInstitutionByYearAllCenters (institutionNames, pubYearMin, pubYearMax, memberYearMin, memberYearMax, minConfidence) {
export default function readPersonsByInstitutionByYearAllCenters (institutionNames, pubYearMin, pubYearMax, memberYearMin, memberYearMax) {
const startDateLT = `1/1/${memberYearMax + 1}`
const endDateGT = `12/31/${memberYearMin - 1}`
let namesString = ''
Expand Down Expand Up @@ -46,30 +46,37 @@ export default function readPersonsByInstitutionByYearAllCenters (institutionNam
institution {
name
}
reviews_persons_publications(
distinct_on: title,
reviews_persons_publications_aggregate(
distinct_on: persons_publications_id,
order_by: {
title: asc,
persons_publications_id: asc,
datetime: desc
},
where: {
review_organization_value: {_eq: "ND"},
year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}
}) {
doi
person_id
title
review_type
}
) {
nodes {
persons_publications_id
doi
person_id
title
review_type
}
}
confidencesets_persons_publications_aggregate(distinct_on: title, order_by: {title: asc, datetime: desc}, where: {year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}}) {
confidencesets_persons_publications_aggregate(distinct_on: persons_publications_id, order_by: {persons_publications_id: asc, datetime: desc}, where: {year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}}) {
nodes {
datetime
doi
id
persons_publications_id
publication_id
value
version
title
source_name
source_id
}
}
persons_namevariances {
Expand Down
29 changes: 17 additions & 12 deletions client/src/gql/readPersonsByInstitutionByYearByOrganization.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gql from 'graphql-tag'
import _ from 'lodash'

export default function readPersonsByInstitutionByYearByOrganization (organizationValue, institutionNames, pubYearMin, pubYearMax, memberYearMin, memberYearMax, minConfidence) {
export default function readPersonsByInstitutionByYearByOrganization (organizationValue, institutionNames, pubYearMin, pubYearMax, memberYearMin, memberYearMax) {
const startDateLT = `1/1/${memberYearMax + 1}`
const endDateGT = `12/31/${memberYearMin - 1}`
let namesString = ''
Expand Down Expand Up @@ -55,8 +55,7 @@ export default function readPersonsByInstitutionByYearByOrganization (organizati
datetime: desc
},
where: {
year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}},
value: {_gte: "${minConfidence}"},
year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}
}
) {
persons_publications_id
Expand All @@ -65,32 +64,38 @@ export default function readPersonsByInstitutionByYearByOrganization (organizati
title
year
}
confidencesets_persons_publications_aggregate(distinct_on: title, order_by: {title: asc, datetime: desc}, where: {year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}}) {
confidencesets_persons_publications_aggregate(distinct_on: persons_publications_id, order_by: {persons_publications_id: asc, datetime: desc}, where: {year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}}) {
nodes {
datetime
doi
id
persons_publications_id
publication_id
value
version
title
source_name
source_id
}
}
reviews_persons_publications(
distinct_on: title,
reviews_persons_publications_aggregate(
distinct_on: persons_publications_id,
order_by: {
title: asc,
persons_publications_id: asc,
datetime: desc
},
where: {
review_organization_value: {_eq: "ND"},
year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}
}
){
doi
person_id
title
review_type
) {
nodes {
persons_publications_id
doi
person_id
title
review_type
}
}
persons_publications_metadata_aggregate (distinct_on: title, where: {year: {_gte: ${pubYearMin}, _lte: ${pubYearMax}}}) {
aggregate {
Expand Down
61 changes: 43 additions & 18 deletions client/src/pages/CenterReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ export default {
this.confidenceSetItems = []
this.confidenceSet = undefined
this.filteredPersonPubCounts = {}
this.filteredPersonPubPendingCounts = {}
// this.filteredPersonPubPendingCounts = {}
this.sortAuthorsByTitle = {}
},
setCurrentPersonMembershipList () {
Expand Down Expand Up @@ -1579,7 +1579,7 @@ export default {
// this.combinedFundersByDoi = {}
// this.uniqueFunders = {}
this.filteredPersonPubCounts = {}
this.filteredPersonPubPendingCounts = {}
// this.filteredPersonPubPendingCounts = {}
// group by institution (i.e., ND author) review and then by doi
// let pubsByTitle = {}
const thisVue = this
Expand Down Expand Up @@ -1758,10 +1758,22 @@ export default {
}
})
},
addFilteredPersonPubPendingCounts (reviewType, authors) {
_.each(authors, (author) => {
if (this.filteredPersonPubPendingCounts[reviewType] && this.filteredPersonPubPendingCounts[reviewType][author.id]) {
this.filteredPersonPubPendingCounts[reviewType][author.id] = this.filteredPersonPubPendingCounts[reviewType][author.id] + 1
} else {
if (!this.filteredPersonPubPendingCounts[reviewType]) {
this.filteredPersonPubPendingCounts[reviewType] = {}
}
this.filteredPersonPubPendingCounts[reviewType][author.id] = 1
}
})
},
removeFilteredPersonPubPendingCounts (reviewType, authors) {
_.each(authors, (author) => {
if (this.filteredPersonPubPendingCounts[reviewType][author.id]) {
this.filteredPersonPubPendingCounts[reviewType][author.id] -= 1
this.filteredPersonPubPendingCounts[reviewType][author.id] = this.filteredPersonPubPendingCounts[reviewType][author.id] - 1
}
})
},
Expand Down Expand Up @@ -2104,7 +2116,7 @@ export default {
const personPubs = pubSet.personPublications
try {
let mutateResults = []
await _.each(personPubs, async (personPub) => {
await pMap(personPubs, async (personPub) => {
// const personPub = personPubs[0]
let selectedCenterValue = this.selectedCenter.value
if (!selectedCenterValue) {
Expand All @@ -2119,7 +2131,19 @@ export default {
}
mutateResults.push(mutateResult)
this.publicationsReloadPending = true
})
const showPendingCounts = (this.selectedPersonTotal && _.startsWith(this.selectedPersonTotal.toLowerCase(), 'pending'))
if (this.reviewTypeFilter === 'pending' && showPendingCounts) {
this.removeFilteredPersonPubPendingCounts(reviewType, [personPub.person])
// // const currentPersonIndex = _.findIndex(this.people, (person) => {
// // console.log('persons', person, this.person)
// // return person.id === this.person.id // todo Rick, this.person never defined, right?
// // })
// // this.people[currentPersonIndex].persons_publications_metadata_aggregate.aggregate.count -= 1
} else if (showPendingCounts && reviewType === 'pending') {
this.addFilteredPersonPubPendingCounts(reviewType, [personPub.person])
}
}, { concurrency: 1 })
await this.loadCenterAuthorOptions()
// remove set from related lists
this.personPublicationsCombinedMatchesByOrgReview[this.reviewTypeFilter] = _.filter(this.personPublicationsCombinedMatchesByOrgReview[this.reviewTypeFilter], (personPub) => {
return pubSet.mainPersonPub.id !== personPub.id
Expand All @@ -2131,22 +2155,23 @@ export default {
this.personPublicationsCombinedMatchesByOrgReview[reviewType].push(pubSet.mainPersonPub)
this.filteredPersonPublicationsCombinedMatchesByOrgReview[reviewType].push(pubSet.mainPersonPub)
// if (this.reviewTypeFilter === 'pending' && this.selectedPersonTotal === 'Pending') {
// // const currentPersonIndex = _.findIndex(this.people, (person) => {
// // console.log('persons', person, this.person)
// // return person.id === this.person.id // todo Rick, this.person never defined, right?
// // })
// // this.people[currentPersonIndex].persons_publications_metadata_aggregate.aggregate.count -= 1
// this.removeFilteredPersonPubPendingCounts(reviewType, [personPub.person])
// // // const currentPersonIndex = _.findIndex(this.people, (person) => {
// // // console.log('persons', person, this.person)
// // // return person.id === this.person.id // todo Rick, this.person never defined, right?
// // // })
// // // this.people[currentPersonIndex].persons_publications_metadata_aggregate.aggregate.count -= 1
// } else if (this.selectedPersonTotal === 'Pending' && reviewType === 'pending') {
// // const currentPersonIndex = _.findIndex(this.people, (person) => {
// // return person.id === this.person.id // todo Rick, this.person never defined, right?
// // })
// // this.people[currentPersonIndex].persons_publications_metadata_aggregate.aggregate.count += 1
// this.addFilteredPersonPubPendingCounts(reviewType, [personPub.person])
// // // const currentPersonIndex = _.findIndex(this.people, (person) => {
// // // return person.id === this.person.id // todo Rick, this.person never defined, right?
// // // })
// // // this.people[currentPersonIndex].persons_publications_metadata_aggregate.aggregate.count += 1
// }
// reload in case any pending counts changed
const titleKey = this.getPublicationTitleKey(pubSet.mainPersonPub.publication.title)
const matchedAuthors = (this.authorsByTitle[titleKey] ? this.authorsByTitle[titleKey] : [])
this.removeFilteredPersonPubPendingCounts('accepted', matchedAuthors)
await this.loadCenterAuthorOptions()
// const titleKey = this.getPublicationTitleKey(pubSet.mainPersonPub.publication.title)
// const matchedAuthors = (this.authorsByTitle[titleKey] ? this.authorsByTitle[titleKey] : [])
// this.removeFilteredPersonPubPendingCounts('accepted', matchedAuthors)
this.clearPublication()
return mutateResults
} catch (error) {
Expand Down
Loading

0 comments on commit b11dc30

Please sign in to comment.