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

Rating feature implementation #538

Open
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

mthani2
Copy link

@mthani2 mthani2 commented Dec 11, 2024

Description

This pull request integrates the rating system feature, including backend endpoints, frontend functionality, and comprehensive testing. The feature enables users to submit ratings for restaurants in a newly added form page titled "Rate a Restaurant" and dynamically updates the displayed average ratings on restaurant cards (planned functionality). While the form is functional and most routes are written, the dynamic updates for the average rating on the eatery cards are not yet operational, as the cards still display "no rating" even after submission.
Motivation: The rating system enhances user interaction and feedback collection, allowing restaurants to monitor and improve their services based on real-time user reviews.

Review System feature: encompassing backend endpoints, frontend functionality, and the review submission flow. The feature allows users to leave detailed feedback for restaurants, including comments on food, service, and cleanliness, as well as an option to recommend the restaurant to others. The feedback is sent via email to the respective restaurant's email address, enabling restaurant managers to review and act on user feedback.
The Review System is accessible through a new "Leave a Review" button added to the navigation bar, which routes users to the ReviewFormPage. The form is fully functional, allowing for email submission, dropdown-based restaurant selection, and feedback input file. (#472)
Motivation: The review system enhances the CMUEats platform by offering a streamlined way for users to provide feedback to restaurants. This feature empowers restaurants to improve their services based on real user experiences and fosters better engagement between the dining establishments and their customers.

Dependencies:
Rating: No new external dependencies were introduced.
Review: This feature introduces Nodemailer as a new dependency to handle email delivery functionality.

Closes #360
and
Closes #472

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Comprehensive testing was implemented to validate the feature:

Unit Tests for Rating: Tested the RatingModel methods to ensure data processing, such as creating, fetching, and calculating averages, functions correctly.
Integration Tests: Validated the backend endpoints (POST, GET, and average rating calculations) to ensure seamless communication between the frontend and backend.
Error Handling Tests: Verified server responses for invalid requests or edge cases.
Manual Testing: The feature was tested manually to verify user interactions, API calls, and dynamic updates on the frontend.

Unit Tests for Review:
Backend Testing:
Verified the feedbackController.js endpoints for CRUD operations, ensuring they process user-submitted feedback accurately.
Tested the emailTransporter.js utility to confirm successful email delivery with valid inputs.
Manual testing was performed using Mailtrap to simulate email delivery and debug authentication issues during development.
Frontend Testing:
Conducted manual testing of the review form on desktop browsers (Chrome, macOS Ventura) to verify input validation, submission flow, and error handling.
Checked dropdown functionality for restaurant selection and ensured email mapping correctness.
Integration Testing:
Validated the end-to-end flow from form submission on the frontend to email delivery via the backend.
Error Handling:
Tested various edge cases, such as invalid email formats and empty required fields, to ensure proper error messages are displayed.

Test Configuration:

Node.js version: 18.x
Desktop/Mobile: Desktop
OS: macOS Ventura
Browser: Chrome

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Future Directions:
Resolve the issue with dynamically updating average ratings on eatery cards. While the backend is fully operational and returns accurate responses, the frontend is not yet reflecting the changes after a new rating is submitted.

  • Enhance error handling on the frontend to provide more detailed feedback to the user if submission fails.
    --> Consider integrating a persistent database for ratings storage instead of the current in-memory database for scalability.

T7alabdullah and others added 30 commits December 7, 2024 20:15
…dropdown with all of the restaurants of CMUeats website
- Added backend functionality to calculate and fetch average ratings
- Integrated frontend logic to display average ratings on eatery cards
- Encountered some errors related to module imports and TypeScript definitions
fdounis and others added 15 commits December 9, 2024 23:26
…folder, in which I created feedbackController.js. Implemented core functions for managing feedback, including create, read, update, and delete operations. Structured the controller to integrate with the feedback model and routes.Added basic validation and error handling to ensure robust feedback processing.
…data using Mongoose. Included fields for user information, feedback content, timestamps, and associated references, ensuring appropriate data validation and default values. This model serves as the foundation for storing and managing feedback records in the database.
…ng middleware for JSON parsing, CORS handling, and logging. Integrated route handling for API endpoints and established a connection to the database using Mongoose. Configured the server to listen on a specified port, ensuring a functional entry point for the backend application.
…e and export a reusable email transporter using Nodemailer. Included setup for SMTP settings, authentication, and default sender information to streamline email-sending functionality across the application. Ensured flexibility for future enhancements, such as template integration or additional email providers.
…ng, and averaging ratings"

This reverts commit 058834a, reversing
changes made to 776bd41.
 the commit. This ensures the comprehensivness of the rating feature, integrating the backend, frontend and testing.
Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmueats ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 7:36pm

Copy link

vercel bot commented Dec 11, 2024

@mthani2 is attempting to deploy a commit to the ScottyLabs Team on Vercel.

A member of the Team first needs to authorize it.

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.

[Feature] Introduce Review System [Feature] Rating system for restaurants
4 participants