Skip to content

Commit

Permalink
outline_response_part_started
Browse files Browse the repository at this point in the history
  • Loading branch information
golanguzb71 committed Oct 16, 2024
1 parent e5a41fa commit 42c1daa
Show file tree
Hide file tree
Showing 9 changed files with 498 additions and 458 deletions.
2 changes: 1 addition & 1 deletion api-gateway/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ const docTemplate = `{
"coherenceScore": {
"type": "integer"
},
"crated_at": {
"createdAt": {
"type": "string"
},
"feedback": {
Expand Down
2 changes: 1 addition & 1 deletion api-gateway/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@
"coherenceScore": {
"type": "integer"
},
"crated_at": {
"createdAt": {
"type": "string"
},
"feedback": {
Expand Down
2 changes: 1 addition & 1 deletion api-gateway/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ definitions:
properties:
coherenceScore:
type: integer
crated_at:
createdAt:
type: string
feedback:
type: string
Expand Down
2 changes: 1 addition & 1 deletion api-gateway/proto/ielts.proto
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ message OutlineWritingResponseAbs{
int32 lexicalResourceScore = 7;
int32 taskAchievementScore = 8;
int32 taskBandScore = 9;
string crated_at = 10;
string createdAt = 10;
}

message UserAnswer{
Expand Down
452 changes: 226 additions & 226 deletions api-gateway/proto/pb/ielts.pb.go

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions ielts-service/internal/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,39 @@ func (r *PostgresRepository) GetResultsInlineBySection(section string, examId st
return &result, nil
}

func (r *PostgresRepository) GetResultOutlineSpeaking(req *pb.GetResultOutlineAbsRequest) (*pb.GetResultOutlineSpeakingResponse, error) {
return nil, nil
}

func (r *PostgresRepository) GetResultOutlineWriting(req *pb.GetResultOutlineAbsRequest) (*pb.GetResultOutlineWritingResponse, error) {
rows, err := r.db.Query(`SELECT task_number, response, feedback, coherence_score, grammar_score, lexical_resource_score, task_achievement_score, task_band_score, created_at FROM writing_detail where exam_id=$1`, req.ExamId)
if err != nil {
return nil, err
}
var result *pb.GetResultOutlineWritingResponse
var answer []*pb.OutlineWritingResponseAbs
var response []byte
for rows.Next() {
var ans pb.OutlineWritingResponseAbs
err = rows.Scan(&ans.TaskNumber, &response, &ans.Feedback, &ans.CoherenceScore, &ans.GrammarScore, &ans.LexicalResourceScore, &ans.TaskAchievementScore, &ans.TaskBandScore, &ans.CreatedAt)
if err != nil {
return nil, err
}
var userResponse struct {
Question string `json:"question"`
UserAnswer string `json:"user_answer"`
}
if err = json.Unmarshal(response, &userResponse); err != nil {
return nil, err
}
ans.Question = userResponse.Question
ans.UserAnswer = userResponse.UserAnswer
answer = append(answer, &ans)
}
result.Answers = answer
return result, nil
}

func validateIELTSBandScores(scores ...float32) error {
validScores := map[float32]bool{
1: true,
Expand Down
7 changes: 7 additions & 0 deletions ielts-service/internal/service/ielts_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,10 @@ func (s *IeltsService) CreateAttemptOutlineSpeaking(ctx context.Context, req *pb
func (s *IeltsService) GetResultsInlineBySection(ctx context.Context, req *pb.GetResultRequest) (*pb.GetResultResponse, error) {
return s.repo.GetResultsInlineBySection(req.Section, req.ExamId)
}

func (s *IeltsService) GetResultOutlineSpeaking(ctx context.Context, req *pb.GetResultOutlineAbsRequest) (*pb.GetResultOutlineSpeakingResponse, error) {
return s.repo.GetResultOutlineSpeaking(req)
}
func (s *IeltsService) GetResultOutlineWriting(ctx context.Context, req *pb.GetResultOutlineAbsRequest) (*pb.GetResultOutlineWritingResponse, error) {
return s.repo.GetResultOutlineWriting(req)
}
2 changes: 1 addition & 1 deletion ielts-service/proto/ielts.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ message OutlineWritingResponseAbs{
int32 lexicalResourceScore = 7;
int32 taskAchievementScore = 8;
int32 taskBandScore = 9;
string crated_at = 10;
string createdAt = 10;
}

message UserAnswer{
Expand Down
454 changes: 227 additions & 227 deletions ielts-service/proto/pb/ielts.pb.go

Large diffs are not rendered by default.

0 comments on commit 42c1daa

Please sign in to comment.