50% completed
This commit is contained in:
parent
05b56150b1
commit
c45770085e
3 changed files with 55 additions and 8 deletions
13
.idea/.idea.EM-Qual/.idea/.gitignore
generated
vendored
Normal file
13
.idea/.idea.EM-Qual/.idea/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/projectSettingsUpdater.xml
|
||||
/modules.xml
|
||||
/contentModel.xml
|
||||
/.idea.EM-Qual.iml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
.idea/.idea.EM-Qual/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.EM-Qual/.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -52,7 +52,14 @@ public static class QualData
|
|||
/// <returns>True if the value is found; false otherwise</returns>
|
||||
public static bool IsContained(string value, string[] possibleValues)
|
||||
{
|
||||
// TODO
|
||||
foreach (var possibleValue in possibleValues)
|
||||
{
|
||||
if (possibleValue.ToLower() == value.ToLower())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -77,8 +84,17 @@ public static class QualData
|
|||
/// <returns>Array of matches in which the supplied country participated</returns>
|
||||
public static Match[] FilterMatchesByCountry(Match[] allMatches, string countryName)
|
||||
{
|
||||
// TODO
|
||||
return [];
|
||||
Match[] filteredMatches = [];
|
||||
foreach (var match in allMatches)
|
||||
{
|
||||
if (IsCountryMatch(match, countryName))
|
||||
{
|
||||
filteredMatches = filteredMatches.Append(match).ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return filteredMatches;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -89,8 +105,9 @@ public static class QualData
|
|||
/// <returns>True if the country participated in the match; false otherwise</returns>
|
||||
public static bool IsCountryMatch(Match match, string countryName)
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
TeamResult homeTeam = match.HomeTeam;
|
||||
TeamResult guestTeam = match.GuestTeam;
|
||||
return homeTeam.TeamName == countryName || guestTeam.TeamName == countryName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -99,7 +116,12 @@ public static class QualData
|
|||
/// <param name="matches">Array of matches to print</param>
|
||||
private static void PrintMatches(Match[] matches)
|
||||
{
|
||||
// TODO
|
||||
foreach (var match in matches)
|
||||
{
|
||||
TeamResult homeTeam = match.HomeTeam;
|
||||
TeamResult guestTeam = match.GuestTeam;
|
||||
Console.WriteLine($"{homeTeam.TeamName} {homeTeam.Goals} - {guestTeam.Goals} {guestTeam.TeamName}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -111,7 +133,13 @@ public static class QualData
|
|||
/// <returns>The name of the country the user selected</returns>
|
||||
private static string AskForCountry(string[] possibleCountries)
|
||||
{
|
||||
// TODO
|
||||
return string.Empty;
|
||||
string country;
|
||||
do
|
||||
{
|
||||
Console.Write("Enter country: ");
|
||||
country = Console.ReadLine()!.ToLower();
|
||||
} while (!IsContained(country!, possibleCountries));
|
||||
|
||||
return country;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue