Skip to content

Devmain#69

Merged
Alwil17 merged 5 commits into
masterfrom
devmain
Jun 7, 2025
Merged

Devmain#69
Alwil17 merged 5 commits into
masterfrom
devmain

Conversation

@Alwil17

@Alwil17 Alwil17 commented Jun 7, 2025

Copy link
Copy Markdown
Owner

This pull request introduces new analytics functionality for the ratings system, including endpoints for retrieving rating distribution, recent ratings, and overall rating statistics. It also adds corresponding data transfer objects (DTOs) and implements the necessary logic in the service and repository layers.

New Analytics Endpoints:

  • Endpoints added to rating_endpoints.py:
    • /distribution: Returns the distribution of ratings across values 1-5 using the RatingDistributionDTO.
    • /recent: Retrieves the most recent ratings, including user and item information, using the RecentRatingDTO.
    • /stats: Provides overall rating statistics, such as the average rating, total count, and top category, using the RatingStatsDTO.

Data Transfer Objects (DTOs):

  • New DTOs added to rating_dto.py:
    • RatingDistributionDTO: Represents the count of ratings for each value (1-5).
    • RecentRatingDTO: Represents recent ratings with fields for rating value, item name, user name, and creation date.
    • RatingStatsDTO: Encapsulates average rating, total count, and the top category (using TopCategoryDTO).

Service Layer Enhancements:

Repository Layer Enhancements:

  • Methods added to RatingRepository:
    • get_rating_distribution: Queries the database for the count of ratings grouped by value (1-5) and ensures all values are represented.
    • get_recent_ratings: Retrieves the most recent ratings with associated user and item information using SQLAlchemy joins.
    • get_rating_stats: Calculates average rating, total count, and identifies the category with the most ratings.

@Alwil17 Alwil17 merged commit 3fc5ec0 into master Jun 7, 2025
4 checks passed
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.

1 participant