Skip to main content
added 106 characters in body
Source Link
Innat3
  • 333
  • 2
  • 8

imo, you can simplify this bit

var assessments = _model.GetDataList("Assessments", "assessment_name");

if (assessments.Any())
{
  HashSet<string> items = new HashSet<string>(assessments);
  assessments = items.ToList();

  for (int i = 0; i < assessments.Count; i++)
  {
      assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
  }

  _view.ExistingAssessments = assessments;
}

to this

var assessments = _model.GetDataList("Assessments", "assessment_name").Distinct().ToList();
if (assessments.Any())
{
    //assessments.ForEach(a => a += $":{_model.CheckStatus(a)}"); -> wont update values
    assessments = assessments.Select(a => a += $":{_model.CheckStatus(a)}").ToList();
    _view.ExistingAssessments = assessments;
}

imo, you can simplify this bit

var assessments = _model.GetDataList("Assessments", "assessment_name");

if (assessments.Any())
{
  HashSet<string> items = new HashSet<string>(assessments);
  assessments = items.ToList();

  for (int i = 0; i < assessments.Count; i++)
  {
      assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
  }

  _view.ExistingAssessments = assessments;
}

to this

var assessments = _model.GetDataList("Assessments", "assessment_name").Distinct().ToList();
if (assessments.Any())
{
    assessments.ForEach(a => a += $":{_model.CheckStatus(a)}");
    _view.ExistingAssessments = assessments;
}

imo, you can simplify this bit

var assessments = _model.GetDataList("Assessments", "assessment_name");

if (assessments.Any())
{
  HashSet<string> items = new HashSet<string>(assessments);
  assessments = items.ToList();

  for (int i = 0; i < assessments.Count; i++)
  {
      assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
  }

  _view.ExistingAssessments = assessments;
}

to this

var assessments = _model.GetDataList("Assessments", "assessment_name").Distinct();
if (assessments.Any())
{
    //assessments.ForEach(a => a += $":{_model.CheckStatus(a)}"); -> wont update values
    assessments = assessments.Select(a => a += $":{_model.CheckStatus(a)}").ToList();
    _view.ExistingAssessments = assessments;
}
improved code formatting
Source Link
t3chb0t
  • 44.3k
  • 9
  • 84
  • 190

imo, you can simplify this bit

var assessments = _model.GetDataList("Assessments", "assessment_name");

        if (assessments.Any())
        {
            HashSet<string> items = new HashSet<string>(assessments);
            assessments = items.ToList();

            for (int i = 0; i < assessments.Count; i++)
            {
                assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
            }

            _view.ExistingAssessments = assessments;
        }
var assessments = _model.GetDataList("Assessments", "assessment_name");

if (assessments.Any())
{
  HashSet<string> items = new HashSet<string>(assessments);
  assessments = items.ToList();

  for (int i = 0; i < assessments.Count; i++)
  {
      assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
  }

  _view.ExistingAssessments = assessments;
}

to this

var assessments = _model.GetDataList("Assessments", "assessment_name").Distinct().ToList();
if (assessments.Any())
        {
            assessments.ForEach(a => a += $":{_model.CheckStatus(a)}");
            _view.ExistingAssessments = assessments;
        }

imo, you can simplify this bit

var assessments = _model.GetDataList("Assessments", "assessment_name");

        if (assessments.Any())
        {
            HashSet<string> items = new HashSet<string>(assessments);
            assessments = items.ToList();

            for (int i = 0; i < assessments.Count; i++)
            {
                assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
            }

            _view.ExistingAssessments = assessments;
        }

to this

var assessments = _model.GetDataList("Assessments", "assessment_name").Distinct().ToList();
if (assessments.Any())
        {
            assessments.ForEach(a => a += $":{_model.CheckStatus(a)}");
            _view.ExistingAssessments = assessments;
        }

imo, you can simplify this bit

var assessments = _model.GetDataList("Assessments", "assessment_name");

if (assessments.Any())
{
  HashSet<string> items = new HashSet<string>(assessments);
  assessments = items.ToList();

  for (int i = 0; i < assessments.Count; i++)
  {
      assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
  }

  _view.ExistingAssessments = assessments;
}

to this

var assessments = _model.GetDataList("Assessments", "assessment_name").Distinct().ToList();
if (assessments.Any())
{
    assessments.ForEach(a => a += $":{_model.CheckStatus(a)}");
    _view.ExistingAssessments = assessments;
}
Source Link
Innat3
  • 333
  • 2
  • 8

imo, you can simplify this bit

var assessments = _model.GetDataList("Assessments", "assessment_name");

        if (assessments.Any())
        {
            HashSet<string> items = new HashSet<string>(assessments);
            assessments = items.ToList();

            for (int i = 0; i < assessments.Count; i++)
            {
                assessments[i] = (assessments[i] + ": " + _model.CheckStatus(assessments[i]));
            }

            _view.ExistingAssessments = assessments;
        }

to this

var assessments = _model.GetDataList("Assessments", "assessment_name").Distinct().ToList();
if (assessments.Any())
        {
            assessments.ForEach(a => a += $":{_model.CheckStatus(a)}");
            _view.ExistingAssessments = assessments;
        }