Skip to content

Commit

Permalink
Version 1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
GiridharRNair committed Jan 14, 2024
1 parent 1341670 commit e63e389
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion api/db/get_aggregated_grades.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func appendProfessorToSQLQuery(sqlQueryBase string, sqlParams []interface{}, rat
sqlQueryBase += " AND (TRIM(instructor1) LIKE ? OR TRIM(instructor1) LIKE ?)"

// Sometimes professor names vary between "First Last" and "Last, First" formats.
// Example: In the database, Bhadrachalam Chitturi is stored as "Bhadrachalam, Chitturi", but in RateMyProfessor, it appears as "Chitturi Bhadrachalam".
sqlParams = append(sqlParams, fmt.Sprintf("%%%s%%%s%%", strings.Fields(rateMyProfessorName)[0], strings.Fields(rateMyProfessorName)[1]))
sqlParams = append(sqlParams, fmt.Sprintf("%%%s%%%s%%", strings.Fields(rateMyProfessorName)[1], strings.Fields(rateMyProfessorName)[0]))
}
Expand Down
5 changes: 2 additions & 3 deletions api/db/get_course_suggestions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
_ "github.com/mattn/go-sqlite3"
)

// Set of diverse courses to suggest if inputs are empty
var defaultCourseSuggestions = []string{"CS 2305", "MATH 2418", "CHEM 2401", "ACCT 6305", "SPAN 2311"}

func GetCourseSuggestions(professorParam, subjectParam, courseNumberParam string) ([]string, error) {
Expand All @@ -16,8 +15,8 @@ func GetCourseSuggestions(professorParam, subjectParam, courseNumberParam string
}

professor := "%" + strings.ReplaceAll(professorParam, " ", "%") + "%"
subject := "%" + subjectParam + "%"
courseNumber := "%" + courseNumberParam + "%"
subject := subjectParam + "%"
courseNumber := courseNumberParam + "%"

courseQuery := `
SELECT DISTINCT subject, catalogNumber
Expand Down
1 change: 0 additions & 1 deletion api/db/get_professor_suggestions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
_ "github.com/mattn/go-sqlite3"
)

// Set of diverse professors to suggest if inputs are empty
var defaultProfessorSuggestions = []string{"Joycelyn Bell", "James Willson", "Stephanie Taylor", "Bentley Garrett", "Karl Sengupta"}

func GetProfessorSuggestions(professorParam string) ([]string, error) {
Expand Down
Binary file modified api/db/utdgrades.db
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"install-packages": "npm install && npm run install-go-packages",
"test-db": "python db_setup/test_db.py",
"create-db": "python db_setup/create_db.py && npm run test-db",
"test-api": "cd api && go test",
"test-api": "npm run create-db && cd api && go test",
"api": "npm run create-db && cd api && nodemon --exec go run main.go --signal SIGTERM",
"start-vite": "vite",
"dev": "concurrently \"vite\" \"npm run api\"",
Expand Down
1 change: 1 addition & 0 deletions src/components/Inputs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function Inputs({ setProfessor, setCourse, professor, course }) {
onClick={() => {
setProfessor("");
setProfessorSuggestions(defaultTeacherSuggestions);
setCourseSuggestions(defaultCourseSuggestions);
}}
/>
)}
Expand Down

0 comments on commit e63e389

Please sign in to comment.