Skip to content

Commit

Permalink
Fix a bug on extending region
Browse files Browse the repository at this point in the history
  • Loading branch information
BoPeng committed Jan 31, 2025
1 parent 264aba1 commit 968c32a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Change the unit of `search-interval` to seconds to allow for more frequent search, although that is not recommended.

## [0.5.0] - 2025-01-29

- Allow each time to add its own `search_interval`
Expand Down
8 changes: 1 addition & 7 deletions src/ai_marketplace_monitor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def validate_sections(self: "Config", config: Dict[str, Any]) -> None:
raise ValueError(f"Config file contains an invalid section {key}.")

def validate_users(self: "Config") -> None:
# check for required fields in each user

"""Check if notified users exists"""
# if user is specified in other section, they must exist
for marketplace_config in self.marketplace.values():
for user in marketplace_config.notify or []:
Expand Down Expand Up @@ -162,10 +161,7 @@ def expand_regions(self: "Config") -> None:
# if region is specified, expand it into search_city
marketplace_config.search_city.extend(region_config.search_city)
# set radius, if market_config already has radius, they should be the same

marketplace_config.radius.extend(region_config.radius)
# remove duplicates
marketplace_config.search_city.extend(list(set(marketplace_config.search_city)))

# if region is specified in any of the items, do the same
for item_config in self.item.values():
Expand All @@ -182,6 +178,4 @@ def expand_regions(self: "Config") -> None:
)
# if region is specified, expand it into search_city
item_config.search_city.extend(region_config.search_city)
#
item_config.radius.extend(region_config.radius)
item_config.search_city.extend(list(set(item_config.search_city)))

0 comments on commit 968c32a

Please sign in to comment.