generated from VLADIMIR/template
add diffectly
This commit is contained in:
@@ -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, "не удалось создать отзыв")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ func mapScenario(o *scenarios_service.Scenario) *proto.Scenario {
|
||||
PublishedAt: publishedAt,
|
||||
AverageRating: o.AverageRating,
|
||||
ReviewsCount: o.ReviewsCount,
|
||||
Difficulty: o.Difficulty,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user