Merge branch 'master' of https://github.com/akhilrex/hammond
This commit is contained in:
@@ -64,7 +64,7 @@ type UpdateExpenseRequest struct {
|
||||
type CreateExpenseRequest struct {
|
||||
VehicleID string `form:"vehicleId" json:"vehicleId" binding:"required"`
|
||||
|
||||
Amount float32 `form:"amount" json:"amount" binding:"required"`
|
||||
Amount float32 `form:"amount" json:"amount"`
|
||||
OdoReading int `form:"odoReading" json:"odoReading"`
|
||||
|
||||
Comments string `form:"comments" json:"comments" `
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/akhilrex/hammond/db"
|
||||
@@ -15,6 +16,9 @@ func GetMileageByVehicleId(vehicleId string, since time.Time) (mileage []models.
|
||||
|
||||
fillups := make([]db.Fillup, len(*data))
|
||||
copy(fillups, *data)
|
||||
sort.Slice(fillups, func(i, j int) bool {
|
||||
return fillups[i].OdoReading > fillups[j].OdoReading
|
||||
})
|
||||
|
||||
var mileages []models.MileageModel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user