Skip to content

Commit

Permalink
Refactor Attendance struct field names for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
waveyboym committed Sep 3, 2024
1 parent 6ffa25d commit 5dc0a94
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions occupi-backend/pkg/models/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ type OfficeHoursFilterStruct struct {
}

type Attendance struct {
Date time.Time `json:"Date" bson:"Date"`
IsWeekend bool `json:"Is_Weekend" bson:"Is_Weekend"`
WeekOfTheYear int `json:"Week_of_the_year" bson:"Week_of_the_year"`
DayOfWeek string `json:"Day_of_week" bson:"Day_of_week"`
DayOfMonth int `json:"Day_of_month" bson:"Day_of_month"`
Month int `json:"Month" bson:"Month"`
SpecialEvent bool `json:"Special_Event" bson:"Special_Event"`
Number_Attended int `json:"Number_Attended" bson:"Number_Attended"`
Date time.Time `json:"Date" bson:"Date"`
IsWeekend bool `json:"Is_Weekend" bson:"Is_Weekend"`
WeekOfTheYear int `json:"Week_of_the_year" bson:"Week_of_the_year"`
DayOfWeek string `json:"Day_of_week" bson:"Day_of_week"`
DayOfMonth int `json:"Day_of_month" bson:"Day_of_month"`
Month int `json:"Month" bson:"Month"`
SpecialEvent bool `json:"Special_Event" bson:"Special_Event"`
NumberAttended int `json:"Number_Attended" bson:"Number_Attended"`
}
2 changes: 1 addition & 1 deletion occupi-backend/pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func OccupiRouter(router *gin.Engine, appsession *models.AppSession) {
analytics.GET("/peak-office-hours", middleware.ProtectedRoute, func(ctx *gin.Context) { handlers.GetAnalyticsOnHours(ctx, appsession, "peakhours", true) })
analytics.GET("/arrival-departure-average", middleware.ProtectedRoute, func(ctx *gin.Context) { handlers.GetAnalyticsOnHours(ctx, appsession, "arrivaldeparture", true) })
analytics.GET("/in-office", middleware.ProtectedRoute, func(ctx *gin.Context) { handlers.GetAnalyticsOnHours(ctx, appsession, "inofficehours", true) })
//analytics.GET("/booking-hours", middleware.ProtectedRoute, func(ctx *gin.Context) { handlers.GetBookingHours(ctx, appsession) })
// analytics.GET("/booking-hours", middleware.ProtectedRoute, func(ctx *gin.Context) { handlers.GetBookingHours(ctx, appsession) })
}
auth := router.Group("/auth")
{
Expand Down
18 changes: 9 additions & 9 deletions occupi-backend/tests/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8253,13 +8253,13 @@ func TestAddAttendance(t *testing.T) {

// Define the attendance object
attendance := models.Attendance{
Date: time.Now(),
IsWeekend: database.IsWeekend(time.Now()),
WeekOfTheYear: database.WeekOfTheYear(time.Now()),
DayOfWeek: database.DayOfTheWeek(time.Now()),
Month: database.Month(time.Now()),
SpecialEvent: false,
Number_Attended: 1,
Date: time.Now(),
IsWeekend: database.IsWeekend(time.Now()),
WeekOfTheYear: database.WeekOfTheYear(time.Now()),
DayOfWeek: database.DayOfTheWeek(time.Now()),
Month: database.Month(time.Now()),
SpecialEvent: false,
NumberAttended: 1,
}

mt.Run("Nil database", func(mt *mtest.T) {
Expand Down Expand Up @@ -8296,7 +8296,7 @@ func TestAddAttendance(t *testing.T) {
{Key: "Special_Event", Value: attendance.SpecialEvent},
{Key: "Month", Value: attendance.Month},
{Key: "Day_of_month", Value: attendance.Date.Day()},
{Key: "Number_Attended", Value: attendance.Number_Attended},
{Key: "Number_Attended", Value: attendance.NumberAttended},
{Key: "Day_of_week", Value: attendance.DayOfWeek},
{Key: "Is_Weekend", Value: attendance.IsWeekend},
{Key: "Week_of_the_year", Value: attendance.WeekOfTheYear},
Expand Down Expand Up @@ -8344,7 +8344,7 @@ func TestAddAttendance(t *testing.T) {
{Key: "Special_Event", Value: attendance.SpecialEvent},
{Key: "Month", Value: attendance.Month},
{Key: "Day_of_month", Value: attendance.Date.Day()},
{Key: "Number_Attended", Value: attendance.Number_Attended},
{Key: "Number_Attended", Value: attendance.NumberAttended},
{Key: "Day_of_week", Value: attendance.DayOfWeek},
{Key: "Is_Weekend", Value: attendance.IsWeekend},
{Key: "Week_of_the_year", Value: attendance.WeekOfTheYear},
Expand Down

0 comments on commit 5dc0a94

Please sign in to comment.