feat(app): add manual entry and sharing flows

This commit is contained in:
JiWoong Sul
2025-11-19 16:36:39 +09:00
parent 5ade584370
commit 947fe59486
110 changed files with 5937 additions and 3781 deletions

View File

@@ -49,7 +49,10 @@ class RecommendationEngine {
if (eligibleRestaurants.isEmpty) return null;
// 3단계: 카테고리 필터링
final filteredByCategory = _filterByCategory(eligibleRestaurants, config.selectedCategories);
final filteredByCategory = _filterByCategory(
eligibleRestaurants,
config.selectedCategories,
);
if (filteredByCategory.isEmpty) return null;
// 4단계: 가중치 계산 및 선택
@@ -57,7 +60,10 @@ class RecommendationEngine {
}
/// 거리 기반 필터링
List<Restaurant> _filterByDistance(List<Restaurant> restaurants, RecommendationConfig config) {
List<Restaurant> _filterByDistance(
List<Restaurant> restaurants,
RecommendationConfig config,
) {
// 날씨에 따른 최대 거리 조정
double effectiveMaxDistance = config.maxDistance;
if (config.weather != null && config.weather!.current.isRainy) {
@@ -98,7 +104,10 @@ class RecommendationEngine {
}
/// 카테고리 필터링
List<Restaurant> _filterByCategory(List<Restaurant> restaurants, List<String> selectedCategories) {
List<Restaurant> _filterByCategory(
List<Restaurant> restaurants,
List<String> selectedCategories,
) {
if (selectedCategories.isEmpty) {
return restaurants;
}
@@ -108,7 +117,10 @@ class RecommendationEngine {
}
/// 가중치 기반 선택
Restaurant? _selectWithWeights(List<Restaurant> restaurants, RecommendationConfig config) {
Restaurant? _selectWithWeights(
List<Restaurant> restaurants,
RecommendationConfig config,
) {
if (restaurants.isEmpty) return null;
// 각 식당에 대한 가중치 계산
@@ -116,7 +128,8 @@ class RecommendationEngine {
double weight = 1.0;
// 카테고리 가중치 적용
final categoryWeight = config.userSettings.categoryWeights[restaurant.category];
final categoryWeight =
config.userSettings.categoryWeights[restaurant.category];
if (categoryWeight != null) {
weight *= categoryWeight;
}
@@ -159,28 +172,23 @@ class RecommendationEngine {
return 0.3;
}
}
// 점심 시간대 (11-14시)
else if (hour >= 11 && hour < 14) {
if (restaurant.category == 'korean' ||
restaurant.category == 'chinese' ||
if (restaurant.category == 'korean' ||
restaurant.category == 'chinese' ||
restaurant.category == 'japanese') {
return 1.3;
}
}
// 저녁 시간대 (17-21시)
else if (hour >= 17 && hour < 21) {
if (restaurant.category == 'bar' ||
restaurant.category == 'western') {
if (restaurant.category == 'bar' || restaurant.category == 'western') {
return 1.2;
}
}
// 늦은 저녁 (21시 이후)
else if (hour >= 21) {
if (restaurant.category == 'bar' ||
restaurant.category == 'fastfood') {
if (restaurant.category == 'bar' || restaurant.category == 'fastfood') {
return 1.3;
}
if (restaurant.category == 'cafe') {
@@ -196,24 +204,21 @@ class RecommendationEngine {
if (weather.current.isRainy) {
// 비가 올 때는 가까운 식당 선호
// 이미 거리 가중치에서 처리했으므로 여기서는 실내 카테고리 선호
if (restaurant.category == 'cafe' ||
restaurant.category == 'fastfood') {
if (restaurant.category == 'cafe' || restaurant.category == 'fastfood') {
return 1.2;
}
}
// 더운 날씨 (25도 이상)
if (weather.current.temperature >= 25) {
if (restaurant.category == 'cafe' ||
restaurant.category == 'japanese') {
if (restaurant.category == 'cafe' || restaurant.category == 'japanese') {
return 1.1;
}
}
// 추운 날씨 (10도 이하)
if (weather.current.temperature <= 10) {
if (restaurant.category == 'korean' ||
restaurant.category == 'chinese') {
if (restaurant.category == 'korean' || restaurant.category == 'chinese') {
return 1.2;
}
}
@@ -222,7 +227,9 @@ class RecommendationEngine {
}
/// 가중치 기반 랜덤 선택
Restaurant? _weightedRandomSelection(List<_WeightedRestaurant> weightedRestaurants) {
Restaurant? _weightedRandomSelection(
List<_WeightedRestaurant> weightedRestaurants,
) {
if (weightedRestaurants.isEmpty) return null;
// 전체 가중치 합계 계산
@@ -254,4 +261,4 @@ class _WeightedRestaurant {
final double weight;
_WeightedRestaurant(this.restaurant, this.weight);
}
}