From 0ea8b34f346b2bbd1995462927481732bd3cc9e8 Mon Sep 17 00:00:00 2001 From: Christophe NINUCCI <36405135+chrnin@users.noreply.github.com> Date: Mon, 31 May 2021 20:23:17 +0200 Subject: [PATCH] =?UTF-8?q?changement=20du=20format=20d'=C3=A9criture=20da?= =?UTF-8?q?ns=20excel=20(#80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * changement du format d'écriture dans excel * prévention panic quand l'activité !nafRev2 * fix: conversion de l'effectif en int pour liste * fix: tester valeur libelle activite pour liste Co-authored-by: fcoufour --- follow.go | 4 +++- score.go | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/follow.go b/follow.go index ca704d10..287bf98b 100644 --- a/follow.go +++ b/follow.go @@ -257,7 +257,9 @@ func (follows Follows) toXLS() ([]byte, Jerror) { row.AddCell().Value = "" } row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.CodeActivite) - row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.LibelleActivite) + if f.EtablissementSummary.LibelleActivite != nil { + row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.LibelleActivite) + } row.AddCell().Value = fmt.Sprintf("%s", *coalescepString(f.EtablissementSummary.Alert, &EmptyString)) row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.Since) row.AddCell().Value = fmt.Sprintf("%s", *f.EtablissementSummary.Category) diff --git a/score.go b/score.go index 94bcf006..e82e42b0 100644 --- a/score.go +++ b/score.go @@ -274,9 +274,11 @@ func (liste *Liste) toXLS(params paramsListeScores) ([]byte, Jerror) { row.AddCell().Value = fmt.Sprintf("%s", score.Siret) row.AddCell().Value = fmt.Sprintf("%s", *score.CodeDepartement) row.AddCell().Value = fmt.Sprintf("%s", *score.RaisonSociale) - row.AddCell().Value = fmt.Sprintf("%f", *score.Effectif) + row.AddCell().Value = fmt.Sprintf("%d", int(*score.Effectif)) row.AddCell().Value = fmt.Sprintf("%s", *score.CodeActivite) - row.AddCell().Value = fmt.Sprintf("%s", *score.LibelleActivite) + if score.LibelleActivite != nil { + row.AddCell().Value = fmt.Sprintf("%s", *score.LibelleActivite) + } row.AddCell().Value = fmt.Sprintf("%s", *score.Alert) }