Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix: count and display 'class changed' proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Dec 16, 2019
1 parent 8e96954 commit af832ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/fallback/PropertyProposals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default {
return !!_get(this.changedPropertyProposals, 'proposals.length')
},
hasProposals () {
return this.hasObjectProposal || this.hasClassProposal || this.hasPropertyProposal
return this.hasObjectProposals || this.hasClassProposals || this.hasPropertyProposals
}
},
apollo: {
Expand Down
8 changes: 6 additions & 2 deletions store/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const actions = {
const isEdit = state.clss.isEdit

const mutation = gql`
mutation (${mutationParam}$headline: String!, $body: String!, $iri: String!, $proposalObject: JSON!, $threadType: ThreadType!, $isEdit: Boolean!) {
mutation (${mutationParam}$headline: String!, $body: String!, $iri: String!, $proposalObject: JSON!, $threadType: ThreadType!, $isEdit: Boolean!, $originalIRI: String) {
upsertThread (input: {
thread: {
${threadInput}
Expand All @@ -89,7 +89,8 @@ export const actions = {
iri: $iri,
proposalObject: $proposalObject,
threadType: $threadType,
isEdit: $isEdit
isEdit: $isEdit,
originalIri: $originalIRI
}
}) {
thread {
Expand All @@ -111,6 +112,9 @@ export const actions = {
if (threadId) {
variables.id = threadId
}
if (state.clss.originalIRI) {
variables.originalIRI = state.clss.originalIRI
}
const result = await this.app.apolloProvider.defaultClient.mutate({
mutation,
variables
Expand Down
4 changes: 3 additions & 1 deletion store/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ export const actions = {
const result = await this.app.apolloProvider.defaultClient.query({
query: countProposals
})

const proposals = _get(result, 'data.proposals.proposals', [])
const count = proposals.reduce((acc, { iri, originalIri, isEdit, proposalObject }) => {
const proposalType = proposalObject[proposalObject[0].proposalType]

if (proposalType === 'Class' && isEdit) {
iri = originalIri
iri = iri || originalIri
}
if (!acc[iri]) {
acc[iri] = {
Expand Down Expand Up @@ -146,6 +147,7 @@ export const actions = {
}
return acc
}, {})

commit('proposalCountByIRI', count)
}
catch (err) {
Expand Down

0 comments on commit af832ce

Please sign in to comment.