func (VS *Server) activity(c *gin.Context) {
	u := VS.getUserFomCookie(c, "h_settings", "activity", "u := VS.getUserFomCookie")
	IDServiceVisualization := Variables["audit"]

	var audits []Audit
	if u.Role == Admin {
		var a bson.ObjectId
		if a == IDServiceVisualization {
			fmt.Print("All audios")
			audits = VS.getAllAudits(c, "h_settings", "activity", "audits = VS.getAuditsByVillage")
		} else {
			fmt.Print("All audios from service")
			fmt.Print("Variables[audit]")
			fmt.Println(IDServiceVisualization)

			audits = VS.getAuditsByService(c, IDServiceVisualization, "h_settings", "activity", "audits = VS.getAuditsByVillage")
			fmt.Print("All audits by service are: ")
			fmt.Println(len(audits))

		}
	} else if u.Role == Manager {
		vill := VS.getLocalVillage(c, "h_settings", "activity", "vill := VS.getLocalVillage")
		audits = VS.getAuditsByVillage(c, vill.ID, "h_settings", "activity", "audits = VS.getAuditsByVillage")
	} else {
		audits = VS.getAuditsByUser(c, u.ID, "h_settings", "activity", "audits = VS.getAuditsByUser")
	}

	var audHTML []AuditDayHTML
	// If we access before make any change to don't go out of range
	if len(audits) > 0 {
		// Second we order them in an array of different days and convert it to HTML
		a := VS.orderAuditPerDay(audits)
		audHTML = VS.auditPerDayToHTML(c, a)
	}
	servicesHTML := VS.getAllServicesPicker(c)
	render(c, gin.H{
		"services":        servicesHTML,
		"audits":          audHTML,
		"role":            u.Role,
		"serviceVisualID": IDServiceVisualization,
	}, "activity.html")
}
// Shows the activity of the user
Shows the activity of the user
// Shows the activity of the user
func (VS *Server) activity(c *gin.Context) {
	u := VS.getUserFomCookie(c, "h_settings", "
activity", "u := VS.getUserFomCookie")
	IDServiceVisualization := Variables["audit"]
	var audits []Audit
	if u.Role == Admin {
		var a bson.ObjectId
		if a == IDServiceVisualization {
			fmt.Print("All audios")
			audits = VS.getAllAudits(c, "h_settings", "
activity", "audits = VS.getAuditsByVillage")
		} else {
			fmt.Print("All audios from service")
			fmt.Print("Variables[audit]")
			fmt.Println(IDServiceVisualization)
			audits = VS.getAuditsByService(c, IDServiceVisualization, "h_settings", "
activity", "audits = VS.getAuditsByVillage")
			fmt.Print("All audits by service are: ")
			fmt.Println(len(audits))
		}
	} else if u.Role == Manager {
		vill := VS.getLocalVillage(c, "h_settings", "
activity", "vill := VS.getLocalVillage")
		audits = VS.getAuditsByVillage(c, vill.ID, "h_settings", "
activity", "audits = VS.getAuditsByVillage")
	} else {
		audits = VS.getAuditsByUser(c, u.ID, "h_settings", "
activity", "audits = VS.getAuditsByUser")
	}
	var audHTML []AuditDayHTML
	if len(audits) > 0 {
		a := VS.orderAuditPerDay(audits)
		audHTML = VS.auditPerDayToHTML(c, a)
	}
	servicesHTML := VS.getAllServicesPicker(c)
	render(c, gin.H{
		"services":        servicesHTML,
		"audits":          audHTML,
		"role":            u.Role,
		"serviceVisualID": IDServiceVisualization,
	}, "activity.html")
}
func ( VS * Server ) activity ( c * gin . Context ) { u := VS . getUserFomCookie ( c , " " , " " , " " ) IDServiceVisualization := Variables [ " " ] var audits [ ] Audit if u . Role == Admin { var a bson . ObjectId if a == IDServiceVisualization { fmt . Print ( " " ) audits = VS . getAllAudits ( c , " " , " " , " " ) } else { fmt . Print ( " " ) fmt . Print ( " " ) fmt . Println ( IDServiceVisualization ) audits = VS . getAuditsByService ( c , IDServiceVisualization , " " , " " , " " ) fmt . Print ( " " ) fmt . Println ( len ( audits ) ) } } else if u . Role == Manager { vill := VS . getLocalVillage ( c , " " , " " , " " ) audits = VS . getAuditsByVillage ( c , vill . ID , " " , " " , " " ) } else { audits = VS . getAuditsByUser ( c , u . ID , " " , " " , " " ) } var audHTML [ ] AuditDayHTML if len ( audits ) > 0 { a := VS . orderAuditPerDay ( audits ) audHTML = VS . auditPerDayToHTML ( c , a ) } servicesHTML := VS . getAllServicesPicker ( c ) render ( c , gin . H { " " : servicesHTML , " " : audHTML , " " : u . Role , " " : IDServiceVisualization , } , " " ) }
Shows the activity of the user
Shows the activity of the user
// If we access before make any change to don't go out of range // Second we order them in an array of different days and convert it to HTML