Adjusting so only one instance of the game is printed.
This commit is contained in:
parent
a1270866a5
commit
920c093ecf
15
src/main.rs
15
src/main.rs
@ -32,17 +32,24 @@ fn main() {
|
||||
let fahrenheit_icon = Icons::Fahrenheit.get_icon_str();
|
||||
// Build the rows for the table.
|
||||
let mut table_rows: Vec<TableRow> = vec![];
|
||||
let mut game_flag = false;
|
||||
for i in 0..entire_forecast.len() {
|
||||
let forecast_period = &entire_forecast[i];
|
||||
let yyyy_mm_dd = &forecast_period.start_time[0..10];
|
||||
let mut sox_status = String::new();
|
||||
// Check if there is a sox game and print opp.
|
||||
for sox_game in &sox_games {
|
||||
if sox_game.date == yyyy_mm_dd {
|
||||
sox_status = format!("{} {}\n{} {}", &baseball_icon, &sox_game.opponent, &clock_icon, &sox_game.start_time);
|
||||
break;
|
||||
if game_flag == false {
|
||||
for sox_game in &sox_games {
|
||||
if sox_game.date == yyyy_mm_dd {
|
||||
sox_status = format!("{} {}\n{} {}", &baseball_icon, &sox_game.opponent, &clock_icon, &sox_game.start_time);
|
||||
game_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
game_flag = false;
|
||||
}
|
||||
let row = TableRow {
|
||||
date: yyyy_mm_dd.to_string(),
|
||||
time_of_day: forecast_period.name.clone(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user