Skip to content

Commit

Permalink
Merge pull request #43 from team-inu/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Porping committed May 4, 2024
2 parents 8ba310b + 2242e71 commit 25911f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions entity/course_portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ type StudentPloData struct {
ProgramLearningOutcomeId string `json:"programLearningOutcomeId"`
Code string `json:"code"`
DescriptionThai string `json:"descriptionThai"`
ProgramYear int `json:"programYear"`
Courses []StudentCourseData `json:"courses"`
}

Expand All @@ -238,6 +239,7 @@ type StudentPlosGorm struct {
ProgramLearningOutcomeId string `gorm:"column:plo_id"`
ProgramLearningOutcomeCode string `gorm:"column:plo_code"`
DescriptionThai string
ProgramYear int
CourseId string
CourseCode string
CourseName string
Expand Down
17 changes: 12 additions & 5 deletions repository/course_portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (r coursePortfolioRepositoryGorm) evaluateTabeeOutcomes(courseId string, se
),
clos AS (
SELECT
target_course.id AS course_id,
course_learning_outcome.id,
expected_passing_assignment_percentage,
program_outcome_id
Expand All @@ -119,16 +120,19 @@ func (r coursePortfolioRepositoryGorm) evaluateTabeeOutcomes(courseId string, se
assignment.expected_score_percentage,
clos.expected_passing_assignment_percentage,
clos.id AS c_id,
assignment.id AS a_id
assignment.id AS a_id,
course_id
FROM clos
JOIN clo_assignment AS ca ON ca.course_learning_outcome_id = clos.id
JOIN assignment ON ca.assignment_id = assignment.id
WHERE assignment.is_included_in_clo IS True
),
scores AS (
SELECT *
SELECT assignments.*, score.*
FROM assignments
JOIN score ON score.assignment_id = a_id
JOIN enrollment ON enrollment.course_id = assignments.course_id AND enrollment.student_id = score.student_id
WHERE status != 'WITHDRAW'
),
student_passing_assignment AS (
SELECT
Expand Down Expand Up @@ -433,9 +437,11 @@ func (r coursePortfolioRepositoryGorm) evaluateOutcomesAllCourses(selector Tabee
WHERE assignment.is_included_in_clo IS True
),
scores AS (
SELECT *
SELECT assignments.*, score.*
FROM assignments
JOIN score ON score.assignment_id = a_id
JOIN enrollment ON enrollment.course_id = assignments.course_id AND enrollment.student_id = score.student_id
WHERE status != 'WITHDRAW'
),
student_passing_assignment AS (
SELECT
Expand Down Expand Up @@ -787,10 +793,11 @@ func (r coursePortfolioRepositoryGorm) evaluateOutcomesByStudentId(studentId str
WHERE assignment.is_included_in_clo IS True
),
scores AS (
SELECT *
SELECT assignments.*, score.*
FROM assignments
JOIN score ON score.assignment_id = a_id
WHERE student_id = ?
JOIN enrollment ON enrollment.course_id = assignments.course_id AND enrollment.student_id = score.student_id
WHERE status != 'WITHDRAW' AND score.student_id = ?
),
student_passing_assignment AS (
SELECT
Expand Down
2 changes: 2 additions & 0 deletions usecase/course_portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ func (u coursePortfolioUseCase) GetOutcomesByStudentId(studentId string) ([]enti
ProgramLearningOutcomeId: record.ProgramLearningOutcomeId,
Code: record.ProgramLearningOutcomeCode,
DescriptionThai: record.DescriptionThai,
ProgramYear: record.ProgramYear,
})
} else {
isExist := false
Expand All @@ -610,6 +611,7 @@ func (u coursePortfolioUseCase) GetOutcomesByStudentId(studentId string) ([]enti
ProgramLearningOutcomeId: record.ProgramLearningOutcomeId,
Code: record.ProgramLearningOutcomeCode,
DescriptionThai: record.DescriptionThai,
ProgramYear: record.ProgramYear,
})
}
}
Expand Down

0 comments on commit 25911f5

Please sign in to comment.