Skip to content

Commit

Permalink
updating reports controller
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnyu committed Jul 3, 2024
1 parent b2f69c2 commit 1f14688
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/reportsController.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ func ReportsIndex(c *gin.Context) {
return
}

isAdmin := getCookie("is-admin", c)

c.HTML(http.StatusOK, "reports-index.html", gin.H{
"months": months,
"days": days,
"years": years,
"partner_codes": partnerCodes,
"isLoggedIn": loggedIn,
"isAdmin": isAdmin,
})
}

Expand All @@ -34,6 +37,8 @@ func ReportRange(c *gin.Context) {
return
}

isAdmin := getCookie("is-admin", c)

var dateRange = database.DateRange{}
if err := c.Bind(&dateRange); err != nil {
c.JSON(http.StatusBadRequest, err.Error())
Expand All @@ -56,6 +61,7 @@ func ReportRange(c *gin.Context) {
"repository": partnerCodes[dateRange.RepositoryID],
"partner_codes": partnerCodes,
"isLoggedIn": loggedIn,
"isAdmin": isAdmin,
})

}
Expand Down

0 comments on commit 1f14688

Please sign in to comment.