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

Added backend for labelling topic as answered by professor #28

Merged
merged 13 commits into from
Oct 11, 2024

Conversation

veronicabenedict
Copy link

Not completed code, but current code for developing the backend of labeling topics as answered or unanswered. create.js, data.js, and posts.js under src/topics were modified. Since the code is still buggy and incomplete, it should not be merged into the main branch.
This PR Resolves #8

@coveralls
Copy link

coveralls commented Oct 9, 2024

Pull Request Test Coverage Report for Build 11283988348

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • 4 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.01%) to 82.682%

Files with Coverage Reduction New Missed Lines %
src/posts/summary.js 1 93.41%
src/topics/posts.js 1 85.18%
src/posts/create.js 2 94.67%
Totals Coverage Status
Change from base Build 11023662044: 0.01%
Covered Lines: 22354
Relevant Lines: 25613

💛 - Coveralls

@veronicabenedict
Copy link
Author

resolves #8

Created an attribute to the database, 'answered', by updating the database in the public/openapi/components/schemas/PostObject.yaml and public/openapi/components/schemas/TopicObject.yaml. I also needed to modify the parameters for the getTopicFields by adding 'answered' as another required field.

Created a function addAnswered in src/topics/posts.js that takes in the topic id and user is, and checks if the user id is an admin id, and sets the topic field for the answered attribute based on the isAdmin boolean. This was modeled similarly to other functions within src/topics/posts.js. Also added the creation of the answered attribute in src/topics/create.js

@veronicabenedict veronicabenedict added this to the Sprint 2 milestone Oct 11, 2024
Copy link

@ldlin1 ldlin1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good! You made all the necessary changes to the database schema as well as the API to accommodate the inclusion of an answered field. The function to check if a post has been answered by an admin in the src/topics/posts.js file also looks good.

@ldlin1 ldlin1 merged commit 05d3dfb into f24 Oct 11, 2024
1 check passed
@veronicabenedict veronicabenedict changed the title Label answered backend Added backend for labelling topic as answered by professor Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

US2 Add back-end logic and UI change of when a question is marked as answered/unanswered by a professor
3 participants