func (VS *Server) orderAuditPerDay(a []Audit) [][]Audit {
	var auditsPerDay [][]Audit
	previousDayAudit := time.Unix(a[0].Date, 0).Day()
	var aux []Audit

	for i := 0; i < len(a); i++ {
		// If the date is different than the previous one, we change the index in the slice
		if previousDayAudit != time.Unix(a[i].Date, 0).Day() {
			previousDayAudit = time.Unix(a[i].Date, 0).Day()
			auditsPerDay = append(auditsPerDay, aux)
			aux = nil
		}
		aux = append(aux, a[i])
	}
	// This one is for adding the last loop
	auditsPerDay = append(auditsPerDay, aux)
	return auditsPerDay
}
// Divides all the audits per day
Divides all the audits per day
// Divides all the audits per day
func (VS *Server) orderAuditPerDay(a []Audit) [][]Audit {
	var auditsPerDay [][]Audit
	previousDayAudit := time.Unix(a[0].Date, 0).Day()
	var aux []Audit
	for i := 0; i < len(a); i++ {
		if previousDayAudit != time.Unix(a[i].Date, 0).Day() {
			previousDayAudit = time.Unix(a[i].Date, 0).Day()
			auditsPerDay = append(auditsPerDay, aux)
			aux = nil
		}
		aux = append(aux, a[i])
	}
	auditsPerDay = append(auditsPerDay, aux)
	return auditsPerDay
}
func ( VS * Server ) orderAuditPerDay ( a [ ] Audit ) [ ] [ ] Audit { var auditsPerDay [ ] [ ] Audit previousDayAudit := time . Unix ( a [ 0 ] . Date , 0 ) . Day ( ) var aux [ ] Audit for i := 0 ; i < len ( a ) ; i ++ { if previousDayAudit != time . Unix ( a [ i ] . Date , 0 ) . Day ( ) { previousDayAudit = time . Unix ( a [ i ] . Date , 0 ) . Day ( ) auditsPerDay = append ( auditsPerDay , aux ) aux = nil } aux = append ( aux , a [ i ] ) } auditsPerDay = append ( auditsPerDay , aux ) return auditsPerDay }
Divides all the audits per day
Divides all the audits per day
// If the date is different than the previous one, we change the index in the slice // This one is for adding the last loop