Skip to content

Commit

Permalink
Refactor WeatherWarninglist filter method to apply filter conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sasanqua-dev committed Oct 7, 2024
1 parent 0006d6a commit 350b5fa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ type WeatherForecastlist struct {
}

func (m WeatherWarninglist) WeatherWarningFilter(filterOption FilterOptions) WeatherWarninglist {
return m
filteredData := make([]WeatherWarning, 0)
for _, warning := range m.data {
// Apply filter conditions here
if warning.reported_at >= filterOption.StartTime.String() && warning.reported_at <= filterOption.EndTime.String() {
filteredData = append(filteredData, warning)
}
}
return WeatherWarninglist{data: filteredData}
}

func (m WeatherForecast) WeatherForecastFilter(filterOption FilterOptions) WeatherForecast {
Expand Down

0 comments on commit 350b5fa

Please sign in to comment.