add diffectly

This commit is contained in:
2026-10-03 14:52:40 +07:00
parent 4631c443e0
commit 7d4361a315
13 changed files with 200 additions and 103 deletions
+11 -10
View File
@@ -13,15 +13,16 @@ import (
func mapGameReview(r *game_review_service.Review) *proto.GameReview {
return &proto.GameReview{
ID: int32(r.ID),
GameID: int32(r.GameID),
TeamID: int32(r.TeamID),
TeamName: r.TeamName,
Rating: r.Rating,
Text: r.Text,
Status: r.Status,
CreatedAt: timestamppb.New(r.CreatedAt),
GameName: r.GameName,
ID: int32(r.ID),
GameID: int32(r.GameID),
TeamID: int32(r.TeamID),
TeamName: r.TeamName,
Rating: r.Rating,
Difficulty: r.Difficulty,
Text: r.Text,
Status: r.Status,
CreatedAt: timestamppb.New(r.CreatedAt),
GameName: r.GameName,
}
}
@@ -34,7 +35,7 @@ func mapGameReviews(reviews []*game_review_service.Review) []*proto.GameReview {
}
func (s *server) CreateGameReview(ctx context.Context, req *proto.CreateGameReviewReq) (*proto.CreateGameReviewRsp, error) {
review, err := s.reviewService.Create(ctx, int(req.GameID), int(req.TeamID), req.Password, req.Rating, req.Text)
review, err := s.reviewService.Create(ctx, int(req.GameID), int(req.TeamID), req.Password, req.Rating, req.Difficulty, req.Text)
if err != nil {
return nil, reviewErrorStatus(err, "не удалось создать отзыв")
}
+2 -1
View File
@@ -97,12 +97,13 @@ func (s *server) GetScenario(ctx context.Context, req *proto.GetScenarioReq) (*p
func (s *server) addScenarioRatings(ctx context.Context, scenarios []*scenarios_service.Scenario) error {
for _, scenario := range scenarios {
average, count, err := s.reviewService.ScenarioRating(ctx, scenario.ID)
average, count, difficulty, err := s.reviewService.ScenarioRating(ctx, scenario.ID)
if err != nil {
return err
}
scenario.AverageRating = average
scenario.ReviewsCount = count
scenario.Difficulty = difficulty
}
return nil
}
+1
View File
@@ -40,6 +40,7 @@ func mapScenario(o *scenarios_service.Scenario) *proto.Scenario {
PublishedAt: publishedAt,
AverageRating: o.AverageRating,
ReviewsCount: o.ReviewsCount,
Difficulty: o.Difficulty,
}
}