diff --git a/api/controllers/professor_information.go b/api/controllers/professor_information.go
index 3011440..ff9a8ac 100644
--- a/api/controllers/professor_information.go
+++ b/api/controllers/professor_information.go
@@ -11,13 +11,6 @@ import (
"github.com/gin-gonic/gin"
)
-// Edge case professors with different names in the database than on RateMyProfessor
-var professorNameCorrections = map[string]string{
- "Ding-Zhu Du": "Ding Du",
- "Sue Brookshire": "Susan Brookshire",
- "Chitturi Bhadrachalam": "Bhadrachalam Chitturi",
-}
-
const ValidateTeacherNameRegex = `[^a-zA-Z\s.\-]|.*\-.*\-`
func GetProfessorInformation(c *gin.Context) {
@@ -46,13 +39,12 @@ func GetProfessorInformation(c *gin.Context) {
return
}
- professorName := professorNameCorrections[professor.Name]
- if professorName == "" {
- professorName = professor.Name
+ if professor.Name == "Chitturi Bhadrachalam" {
+ professor.Name = "Bhadrachalam Chitturi"
}
// possible chance RMP name has middle name
- profNameArray := strings.Fields(professorName)
+ profNameArray := strings.Fields(professor.Name)
profNameWithoutMiddle := fmt.Sprintf("%s %s", profNameArray[0], profNameArray[len(profNameArray)-1])
resultData := gin.H{
diff --git a/api/controllerstest/professor_information_test.go b/api/controllerstest/professor_information_test.go
index 58d3920..ec4106b 100644
--- a/api/controllerstest/professor_information_test.go
+++ b/api/controllerstest/professor_information_test.go
@@ -39,7 +39,7 @@ const timothyFarageExpectedJSON = `{
"Respected",
"Test Heavy"
],
- "would_take_again": 77
+ "would_take_again": 78
}`
func TestGetProfessorInformation(t *testing.T) {
diff --git a/api/professor/professor.go b/api/professor/professor.go
index b737338..d82207b 100644
--- a/api/professor/professor.go
+++ b/api/professor/professor.go
@@ -99,16 +99,16 @@ func (p *Professor) getProfessorTags() {
}
func getProfessorID(professorName, schoolID string) (string, error) {
- // Temporary fix for Scott Dollinger
- if professorName == "Scott Dollinger" {
- return "2523207", nil
- }
-
// Temporary fix for Wei-Pang Chin
- if professorName == "Wei-Pang Chin" {
+ if regexp.MustCompile(`[^a-zA-Z0-9]+`).ReplaceAllString(professorName, "") == "weipangchin" {
return "2420900", nil
}
+ // Temporary fix for Bo Park
+ if regexp.MustCompile(`[^a-zA-Z0-9]+`).ReplaceAllString(professorName, "") == "bopark" {
+ return "2680140", nil
+ }
+
url := fmt.Sprintf(RateMyProfessorSearchURL, schoolID, url.QueryEscape(professorName))
resp, err := http.Get(url)
diff --git a/db_setup/create_db.py b/db_setup/create_db.py
index be48c95..78f84a8 100644
--- a/db_setup/create_db.py
+++ b/db_setup/create_db.py
@@ -53,6 +53,7 @@
# Some professors have their names in different formats in RMP and the UTD data
edge_case_professors = {
+ "Du, Ding Z": "Ding-Zhu Du",
"Nishi, Hirofumi": "Hiro Nishi",
"Macalevey, Paul J": "Paul MacAlevey",
"Mac Alevey, Paul J": "Paul MacAlevey",
diff --git a/package.json b/package.json
index 01ee6bf..be165b0 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "profstatsutd",
"description": "This extension offers a user-friendly interface for accessing aggregated grades and professor ratings effortlessly.",
"private": true,
- "version": "1.1.6",
+ "version": "1.1.7",
"type": "module",
"scripts": {
"install-packages": "npm install && cd api && go mod download",
diff --git a/src/components/GradesGraph.jsx b/src/components/GradesGraph.jsx
index 96a482e..dfaae51 100644
--- a/src/components/GradesGraph.jsx
+++ b/src/components/GradesGraph.jsx
@@ -6,7 +6,7 @@ import { gradeMappings, colorMap } from "../../utils/defaults.js";
ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip);
-function GradesGraph({ grades }) {
+function GradesGraph({ grades, subject, course_number }) {
const gradeLabels = Object.keys(grades).map((grade) => gradeMappings[grade] || grade);
const chartData = {
@@ -29,10 +29,17 @@ function GradesGraph({ grades }) {
titleColor: useColorModeValue("black", "white"),
bodyColor: useColorModeValue("black", "white"),
callbacks: {
- label: (context) => [
- `Students: ${context.parsed.y}`,
- `Percentage: ${((context.parsed.y / Object.values(grades).reduce((acc, count) => acc + count, 0)) * 100).toFixed(2)}%`,
- ],
+ label: (context) => {
+ const tooltipLines = [];
+ if (subject && course_number) {
+ tooltipLines.push(`${subject} ${course_number}`);
+ }
+ tooltipLines.push(`Students: ${context.parsed.y}`);
+ tooltipLines.push(
+ `Percentage: ${((context.parsed.y / Object.values(grades).reduce((acc, count) => acc + count, 0)) * 100).toFixed(2)}%`,
+ );
+ return tooltipLines;
+ },
},
},
},
diff --git a/src/components/ProfessorResults.jsx b/src/components/ProfessorResults.jsx
index 74dd75e..2f2c6f1 100644
--- a/src/components/ProfessorResults.jsx
+++ b/src/components/ProfessorResults.jsx
@@ -110,7 +110,7 @@ function ProfResults({ professorInfo }) {
/>
-
+
diff --git a/utils/defaults.js b/utils/defaults.js
index 2009de9..9334d10 100644
--- a/utils/defaults.js
+++ b/utils/defaults.js
@@ -45,31 +45,31 @@ export const colorMap = {
export const timothyFarage = {
course_number: "",
department: "Computer Science",
- difficulty: 2.3,
+ difficulty: 2.1,
grades: {
- aPlus: 1026,
a: 1186,
aMinus: 277,
- bPlus: 232,
+ aPlus: 1026,
b: 296,
bMinus: 77,
- cPlus: 60,
+ bPlus: 232,
c: 129,
cMinus: 44,
- dPlus: 26,
+ cPlus: 60,
+ cr: 29,
d: 34,
dMinus: 25,
+ dPlus: 26,
f: 47,
- cr: 29,
nc: 5,
w: 40,
},
id: "138341",
name: "Timothy Farage",
- rating: 4.3,
+ rating: 4.2,
subject: "",
tags: ["Amazing Lectures", "Graded By Few Things", "Hilarious", "Respected", "Test Heavy"],
- would_take_again: 81,
+ would_take_again: 78,
};
export const scottDollinger = {
@@ -103,4 +103,4 @@ export const scottDollinger = {
export const defaultTeacherSuggestions = ["John Cole", "Regina Ybarra", "Stephanie Taylor", "Bentley Garrett", "Karl Sengupta"];
-export const defaultCourseSuggestions = ["CE 2336", "MATH 2418", "CHEM 2401", "ACCT 6305", "SPAN 2311"];
+export const defaultCourseSuggestions = ["CS 2305", "MATH 2418", "CHEM 2401", "ACCT 6305", "SPAN 2311"];