From e864a7462469f9d96ae8b06280e27590a0f7e323 Mon Sep 17 00:00:00 2001 From: Fabian Eichhorner Date: Sun, 20 Jan 2019 22:45:14 +0100 Subject: [PATCH] fix small pdf bugs for 1 term --- service-reporting/Utility/TemplateGenerator.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/service-reporting/Utility/TemplateGenerator.cs b/service-reporting/Utility/TemplateGenerator.cs index 1e463fc..5e89c14 100644 --- a/service-reporting/Utility/TemplateGenerator.cs +++ b/service-reporting/Utility/TemplateGenerator.cs @@ -14,7 +14,7 @@ namespace PdfService.Utility private static float CalculateStdDev(IEnumerable values) { double ret = 0; - if (values.Count() > 0) + if (values.Count() > 1) { //Compute the Average double avg = values.Average(); @@ -29,7 +29,7 @@ namespace PdfService.Utility public static string GetHTMLString(Term[] terms) { var sb = new StringBuilder(); - sb.AppendFormat(@" + sb.Append(@" @@ -42,8 +42,15 @@ namespace PdfService.Utility

Sentiment Analysis - Advanced Report

-

- For terms: {0} +

"); + if(terms.Length == 1) { + sb.AppendFormat(@"For term: {0}" + terms[0].Name); + } else { + sb.AppendFormat(@"For terms: {0}" + terms.Select(i => i.Name).Aggregate((i, j) => i + ',' + ' ' + j)); + } + + sb.AppendFormat(@" +

-- 2.43.0