Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading hint in ResultRequest component #373

Closed
KalleEdstroem opened this issue Oct 12, 2023 · 2 comments · Fixed by #378
Closed

Misleading hint in ResultRequest component #373

KalleEdstroem opened this issue Oct 12, 2023 · 2 comments · Fixed by #378
Labels
type:bug Error or unexpected behaviour

Comments

@KalleEdstroem
Copy link
Contributor

KalleEdstroem commented Oct 12, 2023

Description:

The hint for input "cases" in the ...ResultRequest says that If nothing is provided, results for all cases will be assumed.
If no Cases is provided no results are pulled (tested in Lusas20.0) with no hint to why that is.

Steps to reproduce:

Using the provided script and Lusas file to pull results from.
Hover over Cases input to see hint.
Pull results to see difference when a case is provided and when not.

Expected behaviour:

Either all Cases being pulled when no specific case is provided
or a hint that suggest that some Case has to be provided in the Cases input.

Test file(s):

https://burohappold.sharepoint.com/:f:/r/sites/BHoM/02_Current/12_Scripts/01_Issue/BHoM/Lusas_Toolkit/%23373%20Misleading%20hint%20in%20ResultRequest%20component?csf=1&web=1&e=BRp3ut

@peterjamesnugent
Copy link
Member

{
IList cases = request.Cases;
List<int> caseNums = new List<int>();
if (cases is List<string>)
return (cases as List<string>).Select(x => int.Parse(x)).ToList();
else if (cases is List<int>)
return cases as List<int>;
else if (cases is List<double>)
return (cases as List<double>).Select(x => (int)Math.Round(x)).ToList();
else if (cases is List<Loadcase>)
{
for (int i = 0; i < cases.Count; i++)
{
caseNums.Add(System.Convert.ToInt32((cases[i] as Loadcase).Number));
}
}
else if (cases is List<LoadCombination>)
{
foreach (object lComb in cases)
{
foreach (Tuple<double, ICase> lCase in (lComb as LoadCombination).LoadCases)
{
caseNums.Add(System.Convert.ToInt32(lCase.Item2.Number));
}
caseNums.Add((lComb as LoadCombination).AdapterId<int>(typeof(LusasId)));
}
}
else
{
List<int> idsOut = new List<int>();
foreach (object o in cases)
{
int id;
if (int.TryParse(o.ToString(), out id))
{
idsOut.Add(id);
}
}
return idsOut;
}
return caseNums;
}

@KalleEdstroem
Copy link
Contributor Author

Would we want the solution being a warning message stating the reason for why no results are being pulled. Not changing how the code works but providing clarity to the user.

or the solution being that results for all cases actually being pulled as the ...ResultRequest suggest.

I would prefer the second solution but would like some input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants