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

api getWhyRanksAndPoints(discussionId,round, mostIds, leastIds, cb( {ranks: [], points: [] }) #207

Closed
4 of 7 tasks
ddfridley opened this issue Sep 16, 2024 · 8 comments · Fixed by #245
Closed
4 of 7 tasks
Assignees

Comments

@ddfridley
Copy link
Contributor

ddfridley commented Sep 16, 2024

see https://docs.google.com/spreadsheets/d/1hVsobuGFElsuzuKR0Hx4-htCmAQ-POFkHHt9ZGLcmZY/edit?gid=1364079177#gid=1364079177&range=C32:D32

getWhyRanksAndPoints(discussionId,round, mostIds, leastIds, cb( {ranks: [], whys: [] })

from rank, match userId, discussionId, stage: why, round.

If some found, fetch the correspoding why-points by the parentId in the rank.

if there is a why-point for all mostIds and leastIds then return ranks and whys

else get randomWhys for each mostId and leastId and return ranks and whys

  • create app/socket-apis/get-why-ranks-and-points.js
  • create jest tests for:
  • user not logged in
  • nothing found
  • there are two mostIds, and 1 least id, no previous rankings and there are 5 why points for each of the mostIds and leastId
  • there are 5 rankings for each of the mostIds and leastIds
  • there are rankings for one of the mostIds but not the other and not the leastId (user has changed mind)
@ddfridley
Copy link
Contributor Author

@ldgze How is this going?

@ldgze
Copy link
Contributor

ldgze commented Nov 3, 2024

@ldgze How is this going?

Hi David,

I’m still working on the issue and plan to commit the code later today.

@ldgze
Copy link
Contributor

ldgze commented Nov 5, 2024

Hi David @ddfridley,

I have a question about when we should call randomWhys for each mostId and leastId. Specifically, do we need to call randomWhys only when an ID has no existing "why," or should we ensure that each ID has at least 5 "whys" by calling randomWhys to make up any shortfall?

Just want to make sure I align with the requirements. Thanks for clarifying!

@ddfridley
Copy link
Contributor Author

ddfridley commented Nov 5, 2024 via email

@ldgze
Copy link
Contributor

ldgze commented Nov 15, 2024

Hi David,

I’ve implemented the getWhyRanksAndPoints API based on my understanding of the requirements and have created a PR for it. However, I still need some clarifications to ensure everything aligns correctly.

Implementation Steps

  1. Fetch Ranks:
    Query ranks matching userId, discussionId, stage: 'why', and round.

  2. Extract Parent IDs from Ranks:
    Gather parentId values from the fetched ranks.

  3. Fetch Points Based on Parent IDs:
    Query the Points collection for why-points where parentId matches any of the parentIds from the ranks.

  4. Check if All mostIds and leastIds Have Corresponding Why-Points:

    • Step 4.1:
      If all mostIds and leastIds have corresponding why-points:
      • Return ranks and points (Currently, I’m returning the why-points fetched based on ranks, not specifically those matching mostIds and leastIds).
    • Step 4.2:
      If not all mostIds and leastIds have corresponding why-points:
      • Proceed to Step 5.
  5. Fetch Missing Whys Using getRandomWhys:
    For any missing mostIds or leastIds, fetch random whys using getRandomWhys.

My Questions

  1. For Step 4 and Step 5:

    • Should I return the why-points fetched based on ranks?
    • Or should I return the why-points matching the mostIds and leastIds?
  2. Test Case Relationship:

    • When writing test cases, how should I define the relationship between the why-points fetched according to the ranks and those matching the mostIds/leastIds?

Thanks for your time and guidance!

@ddfridley ddfridley moved this from Ready for Review to In Progress in EnCiv Cross Repo Project Management Nov 25, 2024
@ddfridley
Copy link
Contributor Author

@ldgze Hi! I see my responding to this got dropped, And I haven't seen you for a while. Are you still able to work on it? I hope your having a good new year!

@ldgze
Copy link
Contributor

ldgze commented Jan 14, 2025

@ldgze Hi! I see my responding to this got dropped, And I haven't seen you for a while. Are you still able to work on it? I hope your having a good new year!

Hi David,

Happy New Year! I’ve been busy with job hunting recently, but I’ll take a look at the code today and provide an update.

@ddfridley
Copy link
Contributor Author

mostIds and leastIds are 'main-points' that the user has ranked as most/least important.
The ranks for stage: why will be ranks of why-points (not main points). Some why-points will have been entered by the user, other why points will be from other users.
For question1, the why-points returned should be the ones corresponding to the ranks, and/or ones without corresponding ranks yet because they were gatherd by getRandomWhys.
For question 2, mostIds/leastIds are not why points, they are main points.

We only have one collection for points, because the format is the same, and in other situations there could be deeper nesting, main-point, why-point, sub-why-point, sub-sub-why-point. etc. Ie in another discussion we could ask people why they think that's the most important why point. -- it's common in human discussion.

I hope this helps.

Thanks!

@ddfridley ddfridley assigned ddfridley and unassigned ldgze Mar 17, 2025
@ddfridley ddfridley moved this from In Progress to Ready for Review in EnCiv Cross Repo Project Management Mar 17, 2025
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in EnCiv Cross Repo Project Management Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants