Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions: Add votedUsefulQuestions to user model #3450

Open
benfurber opened this issue Apr 17, 2024 · 4 comments
Open

Questions: Add votedUsefulQuestions to user model #3450

benfurber opened this issue Apr 17, 2024 · 4 comments

Comments

@benfurber
Copy link
Member

Like votedUsefulResearch and votedUsefulHowtos, the questions a user has voted useful should be saved too.

As it's likely more content types will get the useful feature in the future, now might be the time to nest all the voted useful in a single field on the user rather than as seperate ones. A mod can do the db migrations to accomidate this.

@goratt12
Copy link
Contributor

goratt12 commented May 18, 2024

Currently, the voteUsefulBy is tracked in the Research/HowTo/Question objects using the ISharedFeatures extends IVotedUseful interface, not in the user object.

Would you prefer to link this feature only to the user, or to both the user and the article?

The advantage of keeping it in the article object is that you don't need to retrieve the user object to check if they marked the article as useful.

If we decide to keep the voteUseful information in both the user and the article, I suggest updating the user via a Cloud Function that detects article updates and makes the necessary updates to the user object.

@mariojsnunes
Copy link
Collaborator

mariojsnunes commented May 19, 2024

Pros for keeping voteUsefulBy in the article:

  • simple solution to list who voted for the article

Cons:

  • we don't have that feature now
  • listing articles requires more bandwidth with the growing number of votes

So I think we could remove it from the articles and instead have a list of voted articles in the user profile.

As for the solution, we want to move away from having the client update the article directly (votedBy and totalVotes), as it requires everyone to have write access.
Since we already have an API, maybe we could use it for this :)

@benfurber
Copy link
Member Author

Until we have a clearer plan about what's next for the API, let's got with a cloud function approach.

Considering our document approach at the moment, I'm not concerned about duplicate data as long as the cloud functions copy from the source of truth into other appropriate docs.

Keeping the ISharedFeatures is probably good. I'd like as much uniformity across our data structure as we can manage! And bandwidth is well under control now.

@iSCJT
Copy link
Contributor

iSCJT commented May 21, 2024

Noticed this discussion when flicking through emails. A little background... the voted useful used to sit on the user object but it was leading to incorrect useful counts being displayed.

The aggregation had to count through all of the user objects when there was a change to get the current count and it wasn't particularly performant, we'd end up with different clients overwriting each others updates etc.

I've not caught up with recent architectural changes in the code base yet but obviously an api + rdbms would be useful for solving all the issues raised in this thread but for now I agree with @benfurber.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New / Under Discussion
Development

No branches or pull requests

4 participants