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

Created posts search function in new file src/topics/search.js #38

Merged
merged 4 commits into from
Sep 29, 2024

Conversation

njouud
Copy link

@njouud njouud commented Sep 25, 2024

This pull request addresses the sub-issue #42 of issue #20 relating to back-end code for User Story 3 (post search functionality). Later commits also address the other sub-issue #43 concerning testing.

Using the user search implementation in src/user/search.js as a guide, I made a new file src/topics/search.js and added search function Topics.search.

Topics.postSearch function: takes user input data (which is an object containing the query or search word, tid which is the topic id, and uid), and returns an object that contains matchCount the number of filtered posts,posts an array of post arrays containing the filtered posts found, timing the time it took to search, and the pageCount of the search result.

Already-exisitng functions utilized:
getTopicPosts: in src/topics/posts.js, returns an array of arrays of post objects belonging to a topic.
getTopicData: in src/topics/data.js, returns the fields of a topic object like tid (topic id).
Both essential for a posts searching mechanism.

Addressing progress in testing (sub-issue #43): test code has been written, however, repeatedly faced error of "topics.postSearch is not a function", will resolve in sprint 2.

@coveralls
Copy link

coveralls commented Sep 25, 2024

Pull Request Test Coverage Report for Build 11051124241

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

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 82.626%

Files with Coverage Reduction New Missed Lines %
src/meta/errors.js 1 76.74%
src/user/approval.js 3 87.61%
Totals Coverage Status
Change from base Build 11038472453: -0.02%
Covered Lines: 22329
Relevant Lines: 25596

💛 - Coveralls

Copy link

@rkensouh rkensouh left a comment

Choose a reason for hiding this comment

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

All good! Ready to complete the other tasks.

Copy link

@hibaabdullahhamad hibaabdullahhamad left a comment

Choose a reason for hiding this comment

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

Great work! Approved.

@hibaabdullahhamad hibaabdullahhamad merged commit c88c5d1 into CMU-17313Q:f24 Sep 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding posts search functionality - back end
4 participants