Skip to content

Commit

Permalink
fix sql query to fetch library only papers
Browse files Browse the repository at this point in the history
Signed-off-by: Rajiv Harlalka <[email protected]>
  • Loading branch information
rajivharlalka committed Sep 10, 2024
1 parent 65d2061 commit fd44702
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func HandleQPYear(w http.ResponseWriter, r *http.Request) {

func HandleLibraryPapers(w http.ResponseWriter, r *http.Request) {
db := db.GetDB()
rows, err := db.Query(context.Background(), "SELECT * FROM iqps WHERE from_library = 'true'")
rows, err := db.Query(context.Background(), "SELECT id, course_code, course_name, year, exam, filelink, from_library FROM iqps WHERE from_library = 'true'")
if err != nil {
sendErrorResponse(w, http.StatusInternalServerError, "Could not Query Question Paper, Try Later!", nil)
return
Expand All @@ -71,7 +71,7 @@ func HandleLibraryPapers(w http.ResponseWriter, r *http.Request) {
err := rows.Scan(&qp.ID, &qp.CourseCode, &qp.CourseName, &qp.Year, &qp.Exam, &qp.FileLink, &qp.FromLibrary)
if err != nil {
sendErrorResponse(w, http.StatusInternalServerError, "error parsing question paper details, contact admin ", nil)
config.Get().Logger.Error("HandleLibraryPapers: Error in parsing question paper details")
config.Get().Logger.Error("HandleLibraryPapers: Error in parsing question paper details:", err.Error())
return
}
qps = append(qps, qp)
Expand Down

0 comments on commit fd44702

Please sign in to comment.