From 9b8f5e851cfc0196fcf78c90e72b1b691981f326 Mon Sep 17 00:00:00 2001 From: Natasa Kasikovic~ Date: Mon, 1 Apr 2024 02:19:44 +0200 Subject: [PATCH] [Fix] ToCSV method to avoid adding an additional separator when there are no skills. --- LangLang/Core/Model/Tutor.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/LangLang/Core/Model/Tutor.cs b/LangLang/Core/Model/Tutor.cs index e99aaa41..d4c6d495 100644 --- a/LangLang/Core/Model/Tutor.cs +++ b/LangLang/Core/Model/Tutor.cs @@ -78,14 +78,19 @@ public void FromCSV(string[] values) public string[] ToCSV() { - string[] csvValues = - { - _profile.ToString(), - _employmentDate.ToString("yyyy-MM-dd"), - DictToCSV(_languageSkills) - }; - - return csvValues; + if (_languageSkills.Count > 0) + { + return new string[] { + _profile.ToString(), + _employmentDate.ToString("yyyy-MM-dd"), + DictToCSV(_languageSkills) }; + } + else + { + return new string[] { + _profile.ToString(), + _employmentDate.ToString("yyyy-MM-dd") }; + } } public string DictToCSV(Dictionary skills)