Fix bug on teleinfo.

This commit is contained in:
chteufleur 2016-12-16 22:49:06 +01:00
parent 8ed7eafbe6
commit 1df76ee4e2
3 changed files with 13 additions and 5 deletions

View File

@ -101,9 +101,8 @@ func (c *SensorsController) PostCompteur() {
teleinfo.UpdateCompteur(adresse, description)
c.Redirect("/sensors", 302)
} else if isDelete != "" {
cpt := teleinfo.GetCompteurByAdresse(adresse)
teleinfo.DeleteCompteur(cpt.Id)
teleinfo.DeleteDataCompteur(cpt.AdresseCompteur)
teleinfo.DeleteCompteurByAdresse(adresse)
teleinfo.DeleteDataCompteur(adresse)
c.Redirect("/sensors", 302)
} else {
c.Redirect("/404", 404)

View File

@ -18,6 +18,11 @@ type AddTeleinfoController struct {
}
func (c *AddTeleinfoController) Prepare() {
sess := c.GetSession(variables.SessionName)
if sess != nil {
c.Data["IsAuthentificated"] = true
}
c.Data["version"] = variables.Version
}
@ -47,6 +52,11 @@ type ViewTeleinfoController struct {
}
func (c *ViewTeleinfoController) Prepare() {
sess := c.GetSession(variables.SessionName)
if sess != nil {
c.Data["IsAuthentificated"] = true
}
c.Data["IsViewTeleinfo"] = true
c.Data["version"] = variables.Version
}
@ -79,7 +89,6 @@ func formatDataSensorTeleInfo(values []teleinfo.TeleinfoTable) string {
if i > 0 {
ret += ","
}
// TODO faire la dérivé de la puissance pour avoir les variations plutot que l'évolution de la puissance
horodate := strconv.FormatInt((values[i].HorodateGMT.Unix()+int64(timezoneOffset))*1000, 10)
value := strconv.FormatInt(values[i].PuissanceApparente, 10)
ret += "[" + horodate + "," + value + "]"

View File

@ -1,7 +1,7 @@
package variables
const (
Version = "0.1.4"
Version = "0.1.5-dev"
SessionName = "Session_Data_House"