Update visualizzazione MAN

This commit is contained in:
Samuele E. Locatelli
2020-02-05 19:43:49 +01:00
parent efbc53db7c
commit 2ec37aedc7
2 changed files with 35 additions and 14 deletions
+34 -13
View File
@@ -40,13 +40,16 @@ namespace IOB_MAN
/// Helper formattazione durata human readable
/// </summary>
/// <param name="timeSpan"></param>
/// <param name="textMode">textMode = come linguaggio scritto</param>
/// <returns></returns>
public static string FormatTimeSpan(TimeSpan timeSpan)
public static string FormatTimeSpan(TimeSpan timeSpan, bool textMode=false)
{
//Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1} {t.Item2}{(t.Item1 == 1 ? string.Empty : "s")}";
//Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1}{t.Item2}";
Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1} {(t.Item1 == 1 ? t.Item2 : t.Item2.Replace("giorno", "giorni").Replace("ora", "ore"))}";
var components = new List<Tuple<int, string>>
if (textMode)
{
//Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1} {t.Item2}{(t.Item1 == 1 ? string.Empty : "s")}";
//Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1}{t.Item2}";
Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1} {(t.Item1 == 1 ? t.Item2 : t.Item2.Replace("giorno", "giorni").Replace("ora", "ore"))}";
var components = new List<Tuple<int, string>>
{
Tuple.Create((int) timeSpan.TotalDays, "giorno"),
Tuple.Create(timeSpan.Hours, "ora"),
@@ -54,18 +57,36 @@ namespace IOB_MAN
Tuple.Create(timeSpan.Seconds, "sec"),
};
components.RemoveAll(i => i.Item1 == 0);
components.RemoveAll(i => i.Item1 == 0);
string extra = "";
string extra = "";
if (components.Count > 1)
{
var finalComponent = components[components.Count - 1];
components.RemoveAt(components.Count - 1);
extra = $" e {tupleFormatter(finalComponent)}";
if (components.Count > 1)
{
var finalComponent = components[components.Count - 1];
components.RemoveAt(components.Count - 1);
extra = $" e {tupleFormatter(finalComponent)}";
}
return $"{string.Join(", ", components.Select(tupleFormatter))}{extra}";
}
else
{
//Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1} {t.Item2}{(t.Item1 == 1 ? string.Empty : "s")}";
//Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1}{t.Item2}";
Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1:00}";
var components = new List<Tuple<int, string>>
{
Tuple.Create((int) timeSpan.TotalDays, "g"),
Tuple.Create(timeSpan.Hours, ""),
Tuple.Create(timeSpan.Minutes, ""),
Tuple.Create(timeSpan.Seconds, ""),
};
return $"{string.Join(", ", components.Select(tupleFormatter))}{extra}";
//components.RemoveAll(i => i.Item1 == 0);
return $"{string.Join(":", components.Select(tupleFormatter))}";
}
}
#region utils lettura app.config
Vendored
+1 -1
View File
@@ -9,7 +9,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=667']) {
withEnv(['NEXT_BUILD_NUMBER=669']) {
// env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'