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();
|
let fahrenheit_icon = Icons::Fahrenheit.get_icon_str();
|
||||||
// Build the rows for the table.
|
// Build the rows for the table.
|
||||||
let mut table_rows: Vec<TableRow> = vec![];
|
let mut table_rows: Vec<TableRow> = vec![];
|
||||||
|
let mut game_flag = false;
|
||||||
for i in 0..entire_forecast.len() {
|
for i in 0..entire_forecast.len() {
|
||||||
let forecast_period = &entire_forecast[i];
|
let forecast_period = &entire_forecast[i];
|
||||||
let yyyy_mm_dd = &forecast_period.start_time[0..10];
|
let yyyy_mm_dd = &forecast_period.start_time[0..10];
|
||||||
let mut sox_status = String::new();
|
let mut sox_status = String::new();
|
||||||
// Check if there is a sox game and print opp.
|
// Check if there is a sox game and print opp.
|
||||||
for sox_game in &sox_games {
|
if game_flag == false {
|
||||||
if sox_game.date == yyyy_mm_dd {
|
for sox_game in &sox_games {
|
||||||
sox_status = format!("{} {}\n{} {}", &baseball_icon, &sox_game.opponent, &clock_icon, &sox_game.start_time);
|
if sox_game.date == yyyy_mm_dd {
|
||||||
break;
|
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 {
|
let row = TableRow {
|
||||||
date: yyyy_mm_dd.to_string(),
|
date: yyyy_mm_dd.to_string(),
|
||||||
time_of_day: forecast_period.name.clone(),
|
time_of_day: forecast_period.name.clone(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user