updates on the admincontroller and the milercontroller and changes in the creaet single order calculations as well
This commit is contained in:
@@ -33,6 +33,12 @@ func MilerStartDuty(c *fiber.Ctx) error {
|
||||
return utils.BadRequest(c, "invalid request body")
|
||||
}
|
||||
|
||||
// A rider still signed in when ops blocked them used to come straight back
|
||||
// to Available here.
|
||||
if milerIsBlocked(milerUserID) {
|
||||
return utils.Forbidden(c, milerNotActiveMessage(constants.MilerBlocked))
|
||||
}
|
||||
|
||||
midnight := todayMidnight()
|
||||
var existing models.MilerDutyLog
|
||||
if err := db.DB.Where("userid = ? AND onduty = ? AND logoutat IS NULL AND loginat >= ?", milerUserID, true, midnight).
|
||||
@@ -237,7 +243,9 @@ func MilerEndBreak(c *fiber.Ctx) error {
|
||||
return utils.Internal(c, "failed to end break")
|
||||
}
|
||||
|
||||
db.DB.Model(&models.MilerProfile{}).Where("userid = ?", milerUserID).Update("availabilitystatus", constants.MilerAvailable)
|
||||
// Ending a break never lifts a block ops applied meanwhile.
|
||||
db.DB.Model(&models.MilerProfile{}).Where("userid = ? AND availabilitystatus <> ?", milerUserID, constants.MilerBlocked).
|
||||
Update("availabilitystatus", constants.MilerAvailable)
|
||||
|
||||
return utils.OK(c, fiber.Map{
|
||||
"breaklogid": breakLog.Breaklogid,
|
||||
|
||||
Reference in New Issue
Block a user