// DashboardOtherTopsHandler returns simple html (expected to be requested by js)
DashboardOtherTopsHandler returns simple html (expected to be requested by js)
// DashboardOtherTopsHandler returns simple html ( expected to be requested by js )
func DashboardOtherTopsHandler(c buffalo.Context) error {
	tx, ok := c.Value("tx").(*pop.Connection)
	if !ok {
		return fmt.Errorf("no transaction found")
	}
	allUsersMostDistance, err := getAllUsersMostDistance(tx)
	if err != nil {
		c.Flash().Add("error", fmt.Sprintf("Error fetching most distance data: %v", err))
	}
	allUsersMostDuration, err := getAllUsersMostDuration(tx)
	if err != nil {
		c.Flash().Add("error", fmt.Sprintf("Error fetching most duration data: %v", err))
	}
	return responder.Wants("html", func(c buffalo.Context) error {
		c.Set("convertPodiumClass", convertPodiumClass)
		c.Set("mostDistance", allUsersMostDistance)
		c.Set("mostDuration", allUsersMostDuration)
		return c.Render(http.StatusOK, r.Plain("/dashboard/other-tops.plush.html"))
	}).Wants("json", func(c buffalo.Context) error {
		return c.Render(200, r.JSON(allUsersMostDistance))
	}).Wants("xml", func(c buffalo.Context) error {
		return c.Render(200, r.XML(allUsersMostDistance))
	}).Respond(c)
}
func DashboardOtherTopsHandler ( c buffalo . Context ) error { tx , ok := c . Value ( " " ) . ( * pop . Connection ) if ! ok { return fmt . Errorf ( " " ) } allUsersMostDistance , err := getAllUsersMostDistance ( tx ) if err != nil { c . Flash ( ) . Add ( " " , fmt . Sprintf ( " " , err ) ) } allUsersMostDuration , err := getAllUsersMostDuration ( tx ) if err != nil { c . Flash ( ) . Add ( " " , fmt . Sprintf ( " " , err ) ) } return responder . Wants ( " " , func ( c buffalo . Context ) error { c . Set ( " " , convertPodiumClass ) c . Set ( " " , allUsersMostDistance ) c . Set ( " " , allUsersMostDuration ) return c . Render ( http . StatusOK , r . Plain ( " " ) ) } ) . Wants ( " " , func ( c buffalo . Context ) error { return c . Render ( 200 , r . JSON ( allUsersMostDistance ) ) } ) . Wants ( " " , func ( c buffalo . Context ) error { return c . Render ( 200 , r . XML ( allUsersMostDistance ) ) } ) . Respond ( c ) }
DashboardOtherTopsHandler returns simple html (expected to be requested by js)
DashboardOtherTopsHandler returns simple html ( expected to be requested by js )
// Get the DB connection from the context