Skip to content

Commit

Permalink
Update Go version and fix test function signature
Browse files Browse the repository at this point in the history
  • Loading branch information
GiridharRNair committed Apr 13, 2024
1 parent 87a0b1f commit 633c43f
Show file tree
Hide file tree
Showing 10 changed files with 1,723 additions and 6,591 deletions.
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use the official Golang base image
FROM golang:1.21.4
FROM golang:1.22.2

# Set the working directory inside the container
WORKDIR /app
Expand Down
4 changes: 1 addition & 3 deletions api/controllerstest/course_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"net/http"
"net/url"
"testing"

"github.com/GiridharRNair/ProfStats-GinAPI/controllers"
)

const courseInfoExpectedJSON = `{
Expand Down Expand Up @@ -35,5 +33,5 @@ func TestGetCourseInformation(t *testing.T) {
{"/course_info?course=lats%206399", http.StatusOK, courseInfoExpectedJSON},
}

testAPIEndpoint(t, testCases, controllers.GetCourseInformation)
testAPIEndpoint(t, testCases)
}
8 changes: 3 additions & 5 deletions api/controllerstest/professor_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import (
"net/http"
"net/url"
"testing"

"github.com/GiridharRNair/ProfStats-GinAPI/controllers"
)

const timothyFarageExpectedJSON = `{
"course_number": "",
"department": "Computer Science",
"difficulty": 2.3,
"difficulty": 2.1,
"grades": {
"a":1186,
"aMinus":277,
Expand All @@ -32,7 +30,7 @@ const timothyFarageExpectedJSON = `{
},
"id": "138341",
"name": "Timothy Farage",
"rating": 4.3,
"rating": 4.2,
"subject": "",
"tags": [
"Amazing Lectures",
Expand Down Expand Up @@ -71,5 +69,5 @@ func TestGetProfessorInformation(t *testing.T) {
{"/professor_info?teacher=Sue%20Brookshire", http.StatusOK, sueBrookshireExpectedJSON},
}

testAPIEndpoint(t, testCases, controllers.GetProfessorInformation)
testAPIEndpoint(t, testCases)
}
3 changes: 1 addition & 2 deletions api/controllerstest/search_suggestions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/http/httptest"
"testing"

"github.com/GiridharRNair/ProfStats-GinAPI/controllers"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -50,7 +49,7 @@ func TestSuggestionsSearchQuery(t *testing.T) {
{"/suggestions?course=CS2337", http.StatusOK, cs2337SuggestionsExpectedInfo},
}

testAPIEndpoint(t, testCases, controllers.SuggestionsSearchQuery)
testAPIEndpoint(t, testCases)

// Seperate test to check the length of the courses array
var jsonResponse map[string]interface{}
Expand Down
2 changes: 1 addition & 1 deletion api/controllerstest/setup_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func init() {
router.GET("/suggestions", controllers.SuggestionsSearchQuery)
}

func testAPIEndpoint(t *testing.T, testCases []TestCases, handlerFunc func(*gin.Context)) {
func testAPIEndpoint(t *testing.T, testCases []TestCases) {
for _, tc := range testCases {
req := httptest.NewRequest("GET", tc.path, nil)
w := httptest.NewRecorder()
Expand Down
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/GiridharRNair/ProfStats-GinAPI

go 1.21.4
go 1.22.2

require (
github.com/gin-gonic/gin v1.9.1
Expand Down
8,271 changes: 1,708 additions & 6,563 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions src/components/InfoIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { InfoOutlineIcon } from "@chakra-ui/icons";

function InfoIcon() {
const [isModalOpen, setIsModalOpen] = useState(false);
const [feedbackButtonIsHovered, setFeedbackButtonIsHovered] = useState(false);
const [githubButtonIsHovered, setGithubButtonIsHovered] = useState(false);

return (
<>
Expand All @@ -21,26 +19,22 @@ function InfoIcon() {
<ModalBody>
<VStack pb={1}>
<Button
leftIcon={!feedbackButtonIsHovered && <Icon as={FcFeedback} boxSize={6} />}
leftIcon={<Icon as={FcFeedback} boxSize={6} />}
onClick={() => window.open("https://forms.gle/gc2G34o2BiiXs4bz7", "_blank")}
onMouseEnter={() => setFeedbackButtonIsHovered(true)}
onMouseLeave={() => setFeedbackButtonIsHovered(false)}
variant="outline"
fontWeight={"medium"}
width={250}
>
{feedbackButtonIsHovered ? "Any issues? Suggestions?" : "Feedback Form"}
Feedback Form
</Button>
<Button
leftIcon={!githubButtonIsHovered && <Icon as={FaGithub} boxSize={6} />}
leftIcon={<Icon as={FaGithub} boxSize={6} />}
onClick={() => window.open("https://github.com/GiridharRNair/ProfStatsUTD", "_blank")}
onMouseEnter={() => setGithubButtonIsHovered(true)}
onMouseLeave={() => setGithubButtonIsHovered(false)}
variant="outline"
fontWeight={"medium"}
width={250}
>
{githubButtonIsHovered ? "Check out the source code!" : "GitHub"}
Github
</Button>
</VStack>
</ModalBody>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Inputs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Inputs({ setProfessor, setCourse, professor, course, isCompareInputs })
<Tooltip placement="top" label="Ignore prefixes, suffixes, and middle names" fontSize={"xs"}>
<AutoCompleteInput
height={8}
placeholder="Enter Teacher Name (ex. John Cole)"
placeholder="Enter Teacher Name"
value={professor}
loadingIcon={<Spinner size={"xs"} mb={2} />}
onChange={(value) => {
Expand Down Expand Up @@ -123,7 +123,7 @@ function Inputs({ setProfessor, setCourse, professor, course, isCompareInputs })
<InputGroup>
<AutoCompleteInput
height={8}
placeholder={courseSuggestions[0] ? `Enter Course (ex. ${courseSuggestions[0]})` : "No courses found for this professor"}
placeholder={"Enter Course"}
value={course}
loadingIcon={<Spinner size={"xs"} mb={2} />}
onChange={(value) => {
Expand Down
4 changes: 1 addition & 3 deletions src/components/RateUsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalCloseBu
import { FcFeedback } from "react-icons/fc";

function RateUsModal() {
const [rateUsModalOpen, setRateUsModalOpen] = useState(
localStorage.getItem("LastInputDataCompare") && !localStorage.getItem("hasRated") && Math.random() < 0.4,
);
const [rateUsModalOpen, setRateUsModalOpen] = useState(localStorage.getItem("LastInputData") && !localStorage.getItem("hasRated") && Math.random() < 0.4);
const [buttonTextColor, setButtonTextColor] = useState("#333");

const generateGradientColor = () => {
Expand Down

0 comments on commit 633c43f

Please sign in to comment.