diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 9405621..4cf018a 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -1,10 +1,16 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {PresetService} from './services/preset.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) -export class AppComponent { - title = 'Travel optimizer'; +export class AppComponent implements OnInit { + constructor(private ps: PresetService) { + } + + ngOnInit(): void { + this.ps.initialize().catch(e => console.log(e)); + } } diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 7b7c18e..0d06b8e 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -20,6 +20,9 @@ import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; import {TranslateModule, TranslateService} from '@ngx-translate/core'; // @ts-ignore import * as enLang from '../assets/i18n/en.json'; +import {HttpClientModule} from '@angular/common/http'; +import {MatButtonToggleModule, MatCheckboxModule} from '@angular/material'; +import {FormsModule} from '@angular/forms'; @NgModule({ @@ -43,7 +46,11 @@ import * as enLang from '../assets/i18n/en.json'; MatInputModule, MatSelectModule, MatProgressSpinnerModule, - TranslateModule.forRoot() + TranslateModule.forRoot(), + HttpClientModule, + MatCheckboxModule, + FormsModule, + MatButtonToggleModule ], providers: [], bootstrap: [AppComponent] diff --git a/frontend/src/app/components/search-input/search-input.component.html b/frontend/src/app/components/search-input/search-input.component.html index 3a00534..db8b198 100644 --- a/frontend/src/app/components/search-input/search-input.component.html +++ b/frontend/src/app/components/search-input/search-input.component.html @@ -1,13 +1,36 @@ - - Start - - - - End - - - Search + + When is your trip? + + Start + + + + End + + + + + + What would you prefer? + + {{key|translate}}: + + {{preset.tag_label|translate}} + + + + + + Whats most important to you? + + {{preset.tag_label|translate}} + + + + Search search diff --git a/frontend/src/app/components/search-input/search-input.component.scss b/frontend/src/app/components/search-input/search-input.component.scss index 886ce23..b8e0673 100644 --- a/frontend/src/app/components/search-input/search-input.component.scss +++ b/frontend/src/app/components/search-input/search-input.component.scss @@ -1,4 +1,28 @@ .search-container { display: flex; flex-direction: column; + + > .group { + flex: 0 0 auto; + display: flex; + flex-direction: column; + box-sizing: border-box; + } + + > .search-btn { + margin-top: 1rem; + } +} + +.sub-group { + margin-bottom: 0.5rem; + + > .label { + font-size: large; + } +} + +.vertical { + display: flex; + flex-direction: column; } diff --git a/frontend/src/app/components/search-input/search-input.component.ts b/frontend/src/app/components/search-input/search-input.component.ts index a341f28..9586af6 100644 --- a/frontend/src/app/components/search-input/search-input.component.ts +++ b/frontend/src/app/components/search-input/search-input.component.ts @@ -2,6 +2,9 @@ import {Component, OnInit} from '@angular/core'; import {Router} from '@angular/router'; import {Query} from '../../interfaces/search-request.interface'; import {objToBase64} from '../../utils/base64conversion'; +import {PresetService} from '../../services/preset.service'; +import {Preset} from '../../interfaces/preset.interface'; +import {formatDate} from '@angular/common'; @Component({ selector: 'app-search-input', @@ -10,7 +13,32 @@ import {objToBase64} from '../../utils/base64conversion'; }) export class SearchInputComponent implements OnInit { - constructor(private router: Router) { + presets: Preset[]; + singlePresets: Preset[]; + multiPresets: Map; + multiPresetsKeys: string[]; + + from: string; + to: string; + singlePresetSelection = {}; + multiPresetSelection = {}; + + constructor(private router: Router, private ps: PresetService) { + this.presets = ps.presets; + this.singlePresets = ps.singlePresets; + this.multiPresets = ps.multiPresets; + this.multiPresetsKeys = [...ps.multiPresets.keys()]; + + const from = new Date(); + const to = new Date(); + to.setDate(from.getDate() + 7); + + this.from = formatDate(from, 'yyyy-MM-dd', 'en-GB'); + this.to = formatDate(to, 'yyyy-MM-dd', 'en-GB'); + + for (const preset of this.singlePresets) { + this.singlePresetSelection[preset.preset_id] = false; + } } ngOnInit() { @@ -18,11 +46,22 @@ export class SearchInputComponent implements OnInit { async onSearch() { const query: Query = { - from: Date.now(), - to: Date.now(), + from: new Date(this.from).getTime(), + to: new Date(this.to).getTime(), }; + for (const preset of this.singlePresets) { + if (this.singlePresetSelection[preset.preset_id]) { + query[preset.parameter] = preset.value; + } + } + + for (const key of this.multiPresetsKeys) { + if (this.multiPresetSelection[key]) { + query[key] = this.presets.find(preset => preset.preset_id === this.multiPresetSelection[key]).value; + } + } + await this.router.navigate(['/search'], {queryParams: {q: objToBase64(query)}}); } - } diff --git a/frontend/src/app/containers/search/search.component.html b/frontend/src/app/containers/search/search.component.html index c6d71a2..c4d6ee1 100644 --- a/frontend/src/app/containers/search/search.component.html +++ b/frontend/src/app/containers/search/search.component.html @@ -1,5 +1,7 @@ + + Suchergebnisse ({{results.length}}): diff --git a/frontend/src/app/containers/search/search.component.ts b/frontend/src/app/containers/search/search.component.ts index 3ff301e..2205b4e 100644 --- a/frontend/src/app/containers/search/search.component.ts +++ b/frontend/src/app/containers/search/search.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit} from '@angular/core'; +import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {Result} from '../../interfaces/result.interface'; import {MOCK_RESULT} from '../../mock/mock-data'; @@ -13,6 +13,9 @@ export class SearchComponent implements OnInit { queryString: string; results: Result[]; + @ViewChild('result', {static: false}) + resultDiv: ElementRef; + constructor(private route: ActivatedRoute) { } @@ -24,6 +27,7 @@ export class SearchComponent implements OnInit { // Mock results setTimeout(() => { this.results = MOCK_RESULT; + this.resultDiv.nativeElement.scrollIntoView({behavior: 'smooth', block: 'start'}); }, 1000); } diff --git a/frontend/src/app/interfaces/preset.interface.ts b/frontend/src/app/interfaces/preset.interface.ts index ade2a72..84c1392 100644 --- a/frontend/src/app/interfaces/preset.interface.ts +++ b/frontend/src/app/interfaces/preset.interface.ts @@ -1,7 +1,7 @@ /** Represents the structure of a search preset. */ export interface Preset { preset_id: number; - preset_name: number; + tag_label: string; parameter: string; value: number[]; } diff --git a/frontend/src/app/interfaces/region.interface.ts b/frontend/src/app/interfaces/region.interface.ts index 15a1230..7544e43 100644 --- a/frontend/src/app/interfaces/region.interface.ts +++ b/frontend/src/app/interfaces/region.interface.ts @@ -8,7 +8,7 @@ export interface Region { country: string; /** Short description of the region */ description: string; - /** Max temperature means per month */ + /** Min temperature means per month */ temperature_mean_max: number[]; /** Monthly precipitation */ precipitation: number[]; @@ -20,6 +20,14 @@ export interface Region { food_costs: number; /** Average alcohol costs per day */ alcohol_costs: number; + /** Average water costs per day */ + water_costs: number; + /** Average costs for local transportation per day */ + local_transportation_costs: number; + /** Average entertainment costs per day */ + entertainment_costs: number; /** Average accommodation costs per day */ accommodation_costs: number; + /** Average costs per day */ + average_per_day_costs: number; } diff --git a/frontend/src/app/mock/mock-data.ts b/frontend/src/app/mock/mock-data.ts index 5fa83f8..d19da52 100644 --- a/frontend/src/app/mock/mock-data.ts +++ b/frontend/src/app/mock/mock-data.ts @@ -1,3 +1,4847 @@ +/* tslint:disable:max-line-length */ import {Result} from '../interfaces/result.interface'; +import {Region} from '../interfaces/region.interface'; +import {Preset} from '../interfaces/preset.interface'; -export const MOCK_RESULT: Result[] = []; +export const MOCK_RESULT: Result[] = [ + { + region_id: 6, + name: 'Sao Paolo', + country: 'Brazil', + description: null, + temperature_mean_max: [ + 27.1, + 28.1, + 27.6, + 26.4, + 22.8, + 21.8, + 22.5, + 23.3, + 25.2, + 25.2, + 25.3, + 27.9 + ], + precipitation: [ + 156.3, + 108.7, + 129.3, + 39.5, + 42.3, + 48.8, + 19.4, + 21.3, + 19.6, + 62, + 98.8, + 96.5 + ], + rain_days: [ + 13, + 8.7, + 11.3, + 3.3, + 5, + 4.5, + 2.8, + 3.4, + 3, + 8.8, + 9.5, + 9 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 13.6, + accommodation_costs: 6.97, + food_costs: 4.42, + water_costs: 0.65, + local_transportation_costs: 1.67, + entertainment_costs: 1.23, + alcohol_costs: 1.08, + scores: [ + { + type: 'temperature_mean_max', + value: 22.3, + score: 9.9 + }, + { + type: 'rain_days', + value: 4.4, + score: 9.3 + } + ], + score: 9.6 + }, + { + region_id: 46, + name: 'San Francisco', + country: 'USA', + description: null, + temperature_mean_max: [ + 14.6, + 16.2, + 17.4, + 18.8, + 19.6, + 21.6, + 22.3, + 22, + 23.5, + 22.5, + 17.7, + 14.4 + ], + precipitation: [ + 82.1, + 65.9, + 76.8, + 41.1, + 3.6, + 5.5, + 0, + 0, + 2.7, + 17.4, + 55.7, + 93.7 + ], + rain_days: [ + 7, + 6.7, + 8.4, + 5, + 1, + 0.8, + 0, + 0, + 0.3, + 2.7, + 5.6, + 7.6 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 61.88, + accommodation_costs: 37.31, + food_costs: 11.83, + water_costs: 1.9300000000000002, + local_transportation_costs: 4.43, + entertainment_costs: 10.92, + alcohol_costs: 5.51, + scores: [ + { + type: 'temperature_mean_max', + value: 20.9, + score: 8.8 + }, + { + type: 'rain_days', + value: 0.7, + score: 9.7 + } + ], + score: 9.25 + }, + { + region_id: 29, + name: 'Lima', + country: 'Peru', + description: null, + temperature_mean_max: [ + 26.7, + 27.9, + 27.3, + 25, + 22.8, + 20.9, + 19.3, + 18.7, + 19.4, + 20.7, + 22.3, + 24.4 + ], + precipitation: [ + 0.6, + 0.9, + 0.4, + 0.3, + 0.4, + 0.6, + 0.9, + 0.7, + 0.7, + 0.5, + 0.4, + 0.4 + ], + rain_days: [ + 0.2, + 0.4, + 0.1, + 0, + 0, + 0, + 0.1, + 0, + 0.1, + 0.1, + 0, + 0.1 + ], + sun_hours: [ + 161, + 158.8, + 183.1, + 189.8, + 91.4, + 33.9, + 23.7, + 22.3, + 38.1, + 59.3, + 80.4, + 127.4 + ], + average_per_day_costs: 20.79, + accommodation_costs: 12.42, + food_costs: 5.4, + water_costs: 0.43, + local_transportation_costs: 1.72, + entertainment_costs: 2.44, + alcohol_costs: 1.49, + scores: [ + { + type: 'temperature_mean_max', + value: 21.4, + score: 9 + }, + { + type: 'rain_days', + value: 0, + score: 9 + } + ], + score: 9 + }, + { + region_id: 37, + name: 'Barcelona', + country: 'Spain', + description: null, + temperature_mean_max: [ + 14.3, + 14.2, + 16.6, + 19.1, + 22.1, + 26.2, + 29, + 29.6, + 26.6, + 23.1, + 18.5, + 15.3 + ], + precipitation: [ + 25, + 43.7, + 64.3, + 39.2, + 37.8, + 27.8, + 26.6, + 35.5, + 60.7, + 87.7, + 61.6, + 11.9 + ], + rain_days: [ + 4, + 4.3, + 5.3, + 5.6, + 4.1, + 2.8, + 2.3, + 3.4, + 5.9, + 6.9, + 5, + 2.2 + ], + sun_hours: [ + 91.2, + 133.2, + 211.2, + 207.8, + 234.8, + 251.8, + 262.8, + 257.8, + 191.4, + 159.2, + 89.8, + 77.8 + ], + average_per_day_costs: 44, + accommodation_costs: 26, + food_costs: 9.5, + water_costs: 0.6, + local_transportation_costs: 5.45, + entertainment_costs: 7.91, + alcohol_costs: 3.88, + scores: [ + { + type: 'temperature_mean_max', + value: 25, + score: 7.5 + }, + { + type: 'rain_days', + value: 3.2, + score: 10 + } + ], + score: 8.75 + }, + { + region_id: 34, + name: 'Johannesburg', + country: 'South Africa', + description: null, + temperature_mean_max: [ + 26, + 26.1, + 24.9, + 21.8, + 20.4, + 17.5, + 17.3, + 20.4, + 24.4, + 25.4, + 25.6, + 26 + ], + precipitation: [ + 124.3, + 73.2, + 89.8, + 50.8, + 20, + 4.1, + 2.8, + 1.3, + 16, + 57.3, + 99.4, + 145.8 + ], + rain_days: [ + 9.4, + 9.4, + 8.4, + 5.7, + 1.8, + 0.5, + 0.6, + 0.4, + 1.9, + 7, + 11, + 14 + ], + sun_hours: [ + 226.7, + 218.4, + 220, + 216.5, + 266.5, + 268.8, + 277.1, + 299.2, + 278.3, + 289, + 253.6, + 228.4 + ], + average_per_day_costs: 32, + accommodation_costs: 15.44, + food_costs: 5.24, + water_costs: 0.74, + local_transportation_costs: 4.9, + entertainment_costs: 5.49, + alcohol_costs: 1.47, + scores: [ + { + type: 'temperature_mean_max', + value: 18.7, + score: 6.6 + }, + { + type: 'rain_days', + value: 1.1, + score: 9.7 + } + ], + score: 8.15 + }, + { + region_id: 8, + name: 'Santiago de Chile', + country: 'Chile', + description: null, + temperature_mean_max: [ + 11.3, + 11.6, + 14.7, + 17.8, + 19.9, + 23, + 25.1, + 25.5, + 23.7, + 20, + 14, + 12.5 + ], + precipitation: [ + 217.4, + 196.7, + 146.4, + 112.3, + 87.4, + 55.1, + 30.3, + 38.3, + 50.1, + 164.2, + 182, + 164.6 + ], + rain_days: [ + 15.9, + 15, + 14.3, + 13.1, + 9.1, + 6.7, + 4.7, + 5.6, + 5.1, + 11.1, + 15.3, + 12.9 + ], + sun_hours: [ + 83.4, + 101.2, + 146.4, + 180.7, + 204.6, + 214.9, + 242.8, + 241.9, + 194, + 164.4, + 102.3, + 97.4 + ], + average_per_day_costs: 42.64, + accommodation_costs: 33.1, + food_costs: 3.91, + water_costs: 0.52, + local_transportation_costs: 1.5699999999999998, + entertainment_costs: 11.63, + alcohol_costs: 2.52, + scores: [ + { + type: 'temperature_mean_max', + value: 22.1, + score: 8.7 + }, + { + type: 'rain_days', + value: 7.3, + score: 6.4 + } + ], + score: 7.55 + }, + { + region_id: 15, + name: 'Berlin', + country: 'Germany', + description: null, + temperature_mean_max: [ + 2.5, + 4.1, + 9.3, + 15.5, + 19.9, + 23.2, + 25.5, + 24.9, + 20.3, + 14.2, + 8.3, + 5 + ], + precipitation: [ + 43.3, + 19.8, + 26.1, + 25.8, + 42.7, + 66.6, + 86.1, + 46.9, + 43.7, + 41.9, + 42.2, + 41.4 + ], + rain_days: [ + 10.9, + 5.8, + 7.4, + 6.2, + 6.6, + 7.7, + 9.6, + 7.7, + 7.9, + 8.7, + 8.3, + 11 + ], + sun_hours: [ + 38, + 86.4, + 140, + 188.1, + 221.3, + 230, + 246.7, + 221.1, + 174, + 116.2, + 58.1, + 36.3 + ], + average_per_day_costs: 38, + accommodation_costs: 18, + food_costs: 15, + water_costs: 0.5, + local_transportation_costs: 5.03, + entertainment_costs: 5.25, + alcohol_costs: 4.24, + scores: [ + { + type: 'temperature_mean_max', + value: 22.3, + score: 8.5 + }, + { + type: 'rain_days', + value: 7.6, + score: 6.1 + } + ], + score: 7.3 + }, + { + region_id: 13, + name: 'London', + country: 'England', + description: null, + temperature_mean_max: [ + 7.9, + 8.3, + 11.6, + 15.4, + 18.4, + 21.8, + 24.4, + 22.9, + 20.3, + 16.3, + 11.4, + 9.1 + ], + precipitation: [ + 70, + 47.7, + 40, + 38.7, + 47, + 45.7, + 45.3, + 63.4, + 39.4, + 49, + 61.7, + 56.2 + ], + rain_days: [ + 13.2, + 9.9, + 9.1, + 8, + 8, + 7.6, + 7.7, + 9.6, + 7.2, + 9.6, + 11, + 10.9 + ], + sun_hours: [ + 54.2, + 68.2, + 120.6, + 171.7, + 188, + 180.8, + 204, + 166.8, + 146.9, + 104.3, + 61.6, + 48.3 + ], + average_per_day_costs: 59, + accommodation_costs: 38, + food_costs: 12, + water_costs: 0.83, + local_transportation_costs: 5.98, + entertainment_costs: 18, + alcohol_costs: 4.07, + scores: [ + { + type: 'temperature_mean_max', + value: 20.9, + score: 8.1 + }, + { + type: 'rain_days', + value: 7.8, + score: 5.9 + } + ], + score: 7 + }, + { + region_id: 38, + name: 'Madrid', + country: 'Spain', + description: null, + temperature_mean_max: [ + 11.3, + 12.3, + 15.9, + 19.9, + 24.4, + 30.3, + 34.2, + 33.8, + 28.9, + 22.6, + 15.1, + 12.1 + ], + precipitation: [ + 29.6, + 36, + 50.8, + 46.2, + 30.2, + 21.5, + 13.7, + 6.1, + 16.1, + 47.6, + 48.6, + 21.9 + ], + rain_days: [ + 5.4, + 5.2, + 7.2, + 7.3, + 5.1, + 3.8, + 1.2, + 1.1, + 2, + 6.1, + 6.9, + 3.6 + ], + sun_hours: [ + 149.6, + 157.7, + 201.2, + 232.4, + 282.2, + 329.4, + 385.8, + 346.2, + 267.8, + 214.9, + 149.9, + 160.1 + ], + average_per_day_costs: 37, + accommodation_costs: 21, + food_costs: 9.27, + water_costs: 0.6, + local_transportation_costs: 5.5600000000000005, + entertainment_costs: 8.47, + alcohol_costs: 4.18, + scores: [ + { + type: 'temperature_mean_max', + value: 28.6, + score: 4.5 + }, + { + type: 'rain_days', + value: 3.9, + score: 9.5 + } + ], + score: 7 + }, + { + region_id: 3, + name: 'Sydney', + country: 'Australia', + description: null, + temperature_mean_max: [ + 28.3, + 27.7, + 26.5, + 23.8, + 21.2, + 18.3, + 18.4, + 19.3, + 22.1, + 24, + 25.4, + 27.1 + ], + precipitation: [ + 84.8, + 91.3, + 127.2, + 123.9, + 59.2, + 154.7, + 68.2, + 64.2, + 45.4, + 61.8, + 85.8, + 72.8 + ], + rain_days: [ + 7.6, + 7.4, + 10.7, + 9.8, + 5.6, + 9.4, + 6.7, + 5.7, + 6, + 7.9, + 8.1, + 7.4 + ], + sun_hours: [ + 235.6, + 206.1, + 202.8, + 208.9, + 218.4, + 160, + 221, + 255.7, + 241.5, + 240, + 232.1, + 239.7 + ], + average_per_day_costs: 43.2, + accommodation_costs: 25.2, + food_costs: 10.2, + water_costs: 1.04, + local_transportation_costs: 4.03, + entertainment_costs: 9, + alcohol_costs: 4.42, + scores: [ + { + type: 'temperature_mean_max', + value: 19.5, + score: 7.4 + }, + { + type: 'rain_days', + value: 7.3, + score: 6.4 + } + ], + score: 6.9 + }, + { + region_id: 16, + name: 'Athen', + country: 'Greece', + description: null, + temperature_mean_max: [ + 13.6, + 15.2, + 17.5, + 22.1, + 26.8, + 31.3, + 34.6, + 34.6, + 30.9, + 23.8, + 19.4, + 14.9 + ], + precipitation: [ + 53.1, + 66.7, + 36.7, + 14.2, + 23.1, + 24.8, + 9.6, + 0.9, + 28.2, + 37.7, + 60.1, + 63 + ], + rain_days: [ + 6.9, + 6.3, + 5.1, + 2.1, + 2.9, + 3.6, + 0.6, + 0.4, + 2, + 3.7, + 5.1, + 5.7 + ], + sun_hours: [ + 133.6, + 130, + 209, + 269, + 287.8, + 336.8, + 395, + 367.3, + 282, + 200, + 139.3, + 124.8 + ], + average_per_day_costs: 29, + accommodation_costs: 16, + food_costs: 7.9, + water_costs: 0.91, + local_transportation_costs: 4.96, + entertainment_costs: 5.22, + alcohol_costs: 3.95, + scores: [ + { + type: 'temperature_mean_max', + value: 30.1, + score: 3.1 + }, + { + type: 'rain_days', + value: 2.8, + score: 9.9 + } + ], + score: 6.5 + }, + { + region_id: 35, + name: 'Kapstadt', + country: 'South Africa', + description: null, + temperature_mean_max: [ + 27.5, + 27.4, + 26, + 24.1, + 20.7, + 17.9, + 18.1, + 18.3, + 19.7, + 22.8, + 24, + 26.4 + ], + precipitation: [ + 9, + 7.9, + 16.4, + 30, + 46.2, + 89.4, + 63.1, + 69.1, + 36.8, + 15.8, + 26.8, + 11.3 + ], + rain_days: [ + 1.8, + 1.6, + 3.1, + 4.3, + 7.2, + 10.2, + 7.2, + 9.4, + 6.3, + 4.3, + 4, + 2.7 + ], + sun_hours: [ + 354.3, + 311.3, + 286.8, + 251.1, + 196, + 169.8, + 206.4, + 206, + 227.3, + 291, + 313.4, + 351.3 + ], + average_per_day_costs: 38.66, + accommodation_costs: 10.14, + food_costs: 23.47, + water_costs: 0.21, + local_transportation_costs: 4.9, + entertainment_costs: 6.03, + alcohol_costs: 13.67, + scores: [ + { + type: 'temperature_mean_max', + value: 19.1, + score: 7 + }, + { + type: 'rain_days', + value: 8.4, + score: 5.3 + } + ], + score: 6.15 + }, + { + region_id: 36, + name: 'Seoul', + country: 'South Korea', + description: null, + temperature_mean_max: [ + 1, + 4.7, + 11.2, + 17.7, + 24.3, + 28.5, + 29.7, + 30.8, + 26.7, + 20.6, + 12, + 3.2 + ], + precipitation: [ + 12.9, + 32, + 31.7, + 87, + 89.8, + 127, + 454.9, + 243.7, + 144.4, + 58.7, + 51.8, + 27.6 + ], + rain_days: [ + 2.8, + 3.2, + 4.2, + 8, + 6.4, + 6.8, + 13.6, + 12, + 5.9, + 4.4, + 7.7, + 4.7 + ], + sun_hours: [ + 190.6, + 184.8, + 225, + 214, + 250.7, + 225, + 141.8, + 173.4, + 202.8, + 226.2, + 166.3, + 183.1 + ], + average_per_day_costs: 45.15, + accommodation_costs: 29.34, + food_costs: 9.13, + water_costs: 0.68, + local_transportation_costs: 3.88, + entertainment_costs: 7.66, + alcohol_costs: 3.15, + scores: [ + { + type: 'temperature_mean_max', + value: 27, + score: 5.9 + }, + { + type: 'rain_days', + value: 7.9, + score: 5.9 + } + ], + score: 5.9 + }, + { + region_id: 26, + name: 'Marrakesch', + country: 'Morocco', + description: null, + temperature_mean_max: [ + 19.6, + 20.1, + 23.5, + 26.6, + 29.9, + 34, + 38, + 38.7, + 32.9, + 29.6, + 23.2, + 21.2 + ], + precipitation: [ + 25.9, + 19.3, + 29, + 24.8, + 15.9, + 2.2, + 2.8, + 11, + 20.7, + 17.7, + 43.9, + 12.8 + ], + rain_days: [ + 3.8, + 3.7, + 4.1, + 3.1, + 2.4, + 0.4, + 0.4, + 1.6, + 1.4, + 2.3, + 5.3, + 2.2 + ], + sun_hours: [ + 234, + 234.9, + 263.6, + 280.2, + 292.1, + 327.3, + 333.2, + 304.3, + 263.4, + 245.6, + 217.1, + 242.2 + ], + average_per_day_costs: 19.07, + accommodation_costs: 12.28, + food_costs: 3.91, + water_costs: 0.62, + local_transportation_costs: 1.8599999999999999, + entertainment_costs: 2.14, + alcohol_costs: 4.74, + scores: [ + { + type: 'temperature_mean_max', + value: 33.1, + score: 1.2 + }, + { + type: 'rain_days', + value: 1.2, + score: 9.6 + } + ], + score: 5.4 + }, + { + region_id: 7, + name: 'Toronto', + country: 'Canada', + description: null, + temperature_mean_max: [ + -2.2, + -0.4, + 6.4, + 14, + 21.5, + 23.8, + 28.5, + 27.4, + 21.2, + 14.9, + 9, + -0.8 + ], + precipitation: [ + 33, + 36, + 76.5, + 67.5, + 52, + 192, + 90, + 60, + 88, + 58, + 59, + 38 + ], + rain_days: [ + 8, + 8.5, + 8.5, + 8, + 11, + 14, + 7, + 6, + 10, + 9, + 7, + 5 + ], + sun_hours: [ + 91.5, + 91.5, + 183.5, + 191, + 268, + 253, + 308, + 265, + 189, + 160, + 138, + 67 + ], + average_per_day_costs: 48.18, + accommodation_costs: 21.78, + food_costs: 13.2, + water_costs: 0.85, + local_transportation_costs: 7.26, + entertainment_costs: 7.92, + alcohol_costs: 6.42, + scores: [ + { + type: 'temperature_mean_max', + value: 23.7, + score: 8.4 + }, + { + type: 'rain_days', + value: 11.5, + score: 2.3 + } + ], + score: 5.35 + }, + { + region_id: 42, + name: 'Chicago', + country: 'USA', + description: null, + temperature_mean_max: [ + -0.4, + 1.4, + 8.5, + 14.8, + 21.8, + 27.1, + 29.4, + 28.4, + 24.3, + 17.4, + 9.1, + 2.7 + ], + precipitation: [ + 48.2, + 58.1, + 58.8, + 100.3, + 135.7, + 128.6, + 129.7, + 93, + 66.9, + 88, + 60.9, + 58.1 + ], + rain_days: [ + 7.1, + 7.6, + 7.6, + 9.4, + 11.2, + 9.6, + 7.7, + 8.1, + 6.9, + 8.1, + 7, + 8 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 59.15, + accommodation_costs: 36.4, + food_costs: 11.83, + water_costs: 1.46, + local_transportation_costs: 10.92, + entertainment_costs: 10.01, + alcohol_costs: 6.49, + scores: [ + { + type: 'temperature_mean_max', + value: 25.3, + score: 7 + }, + { + type: 'rain_days', + value: 9.9, + score: 3.7 + } + ], + score: 5.35 + }, + { + region_id: 9, + name: 'Peking', + country: 'China', + description: null, + temperature_mean_max: [ + 1.8, + 5.4, + 13.4, + 21.3, + 28, + 30.9, + 32.2, + 31.3, + 26.3, + 19.1, + 10.3, + 3.8 + ], + precipitation: [ + 1.7, + 5.2, + 7.4, + 22.6, + 26.7, + 85, + 199.9, + 120.1, + 66.6, + 33.4, + 15.7, + 1.6 + ], + rain_days: [ + 0.2, + 1.7, + 1.3, + 3.1, + 3.3, + 7.9, + 8.6, + 7.1, + 5.2, + 3.4, + 1.7, + 0.4 + ], + sun_hours: [ + 190.2, + 174.3, + 226.4, + 240.4, + 261.5, + 209.2, + 174.9, + 211.9, + 200.6, + 180.2, + 166.3, + 181.1 + ], + average_per_day_costs: 19.24, + accommodation_costs: 10.4, + food_costs: 4.55, + water_costs: 0.34, + local_transportation_costs: 1.12, + entertainment_costs: 5.85, + alcohol_costs: 1.95, + scores: [ + { + type: 'temperature_mean_max', + value: 29.9, + score: 2.8 + }, + { + type: 'rain_days', + value: 6.1, + score: 7.4 + } + ], + score: 5.1 + }, + { + region_id: 23, + name: 'Tokio', + country: 'Japan', + description: null, + temperature_mean_max: [ + 10, + 10.6, + 14.4, + 19.4, + 24.3, + 26.4, + 31, + 31.9, + 27.9, + 22.5, + 17.1, + 12.2 + ], + precipitation: [ + 45.7, + 78.1, + 113.9, + 149.7, + 132.4, + 168.2, + 109.1, + 138.6, + 292.4, + 228.8, + 97.3, + 69.2 + ], + rain_days: [ + 3.6, + 6.1, + 8.7, + 9.1, + 9, + 12.2, + 9.9, + 8.3, + 13.1, + 10.3, + 8.1, + 6 + ], + sun_hours: [ + 209.2, + 157.6, + 182.7, + 180, + 207.3, + 139.8, + 181.2, + 179.6, + 135.3, + 128.8, + 148.1, + 181 + ], + average_per_day_costs: 43.81, + accommodation_costs: 21.53, + food_costs: 11.62, + water_costs: 0.51, + local_transportation_costs: 4.48, + entertainment_costs: 8.98, + alcohol_costs: 11.85, + scores: [ + { + type: 'temperature_mean_max', + value: 26.4, + score: 6.5 + }, + { + type: 'rain_days', + value: 10.4, + score: 3.1 + } + ], + score: 4.8 + }, + { + region_id: 10, + name: 'Shanghai', + country: 'China', + description: null, + temperature_mean_max: [ + 8.4, + 9.9, + 14.8, + 20.8, + 25.5, + 27.5, + 33.3, + 32.6, + 27.9, + 22.9, + 17.6, + 10.9 + ], + precipitation: [ + 49.1, + 66.3, + 83, + 91.7, + 105.9, + 199.4, + 125.9, + 192.9, + 162.3, + 106.3, + 64.2, + 57.7 + ], + rain_days: [ + 5.9, + 7.4, + 9.4, + 8.6, + 8.6, + 10.6, + 8.2, + 10.8, + 8.6, + 5.9, + 7.8, + 6.4 + ], + sun_hours: [ + 111.5, + 106.2, + 143.8, + 166.7, + 165.9, + 94.1, + 183.6, + 176.2, + 137.6, + 141, + 111, + 125.8 + ], + average_per_day_costs: 32.24, + accommodation_costs: 21.32, + food_costs: 6.5, + water_costs: 0.32, + local_transportation_costs: 1.1400000000000001, + entertainment_costs: 2.34, + alcohol_costs: 2.21, + scores: [ + { + type: 'temperature_mean_max', + value: 27.8, + score: 5.2 + }, + { + type: 'rain_days', + value: 9.3, + score: 4.3 + } + ], + score: 4.75 + }, + { + region_id: 11, + name: 'Bogota', + country: 'Colombia', + description: null, + temperature_mean_max: [ + 20.5, + 19.8, + 19.9, + 19.1, + 19.5, + 18.6, + 18.7, + 19.1, + 19, + 19.6, + 19.3, + 19.8 + ], + precipitation: [ + 29, + 56, + 78, + 146.5, + 108, + 57.8, + 55.3, + 47, + 63.3, + 107.3, + 121.7, + 59.7 + ], + rain_days: [ + 4.4, + 6.8, + 9.1, + 14, + 13.3, + 9.8, + 9.7, + 7.6, + 8.4, + 12.2, + 12.6, + 6.8 + ], + sun_hours: [ + 206.1, + 141, + 119.6, + 105.2, + 103.6, + 121.6, + 129.2, + 128.4, + 116, + 120.5, + 113.8, + 159.7 + ], + average_per_day_costs: 12.61, + accommodation_costs: 6.75, + food_costs: 2.7199999999999998, + water_costs: 0.36, + local_transportation_costs: 1.7, + entertainment_costs: 1.69, + alcohol_costs: 1.9, + scores: [ + { + type: 'temperature_mean_max', + value: 19, + score: 6.9 + }, + { + type: 'rain_days', + value: 11.2, + score: 2.3 + } + ], + score: 4.6 + }, + { + region_id: 12, + name: 'Kairo', + country: 'Egypt', + description: null, + temperature_mean_max: [ + 19, + 21.5, + 24.8, + 28.4, + 32.5, + 34.6, + 34.9, + 35.3, + 33.6, + 29.9, + 25, + 20.5 + ], + precipitation: [ + 4.5, + 3.3, + 2.4, + 3.4, + 0.1, + 0, + 0, + 0, + 0, + 0.1, + 2.4, + 3.2 + ], + rain_days: [ + 1.5, + 0.8, + 0.3, + 0.4, + 0, + 0, + 0, + 0, + 0, + 0, + 0.8, + 0.8 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 9.16, + accommodation_costs: 6.09, + food_costs: 1.33, + water_costs: 0.13, + local_transportation_costs: 1.45, + entertainment_costs: 3.07, + alcohol_costs: 0.7, + scores: [ + { + type: 'temperature_mean_max', + value: 33.8, + score: 0.1 + }, + { + type: 'rain_days', + value: 0, + score: 8.9 + } + ], + score: 4.5 + }, + { + region_id: 47, + name: 'Dubai', + country: 'VAE', + description: null, + temperature_mean_max: [ + 24.6, + 26.5, + 29.1, + 33.9, + 38.1, + 40.4, + 42.5, + 41.7, + 40.2, + 36.1, + 30.6, + 26.5 + ], + precipitation: [ + 7.9, + 6.8, + 9.9, + 6.7, + 0.2, + 0, + 0.2, + 0.2, + 0.1, + 0.5, + 13.6, + 2.9 + ], + rain_days: [ + 1, + 1.5, + 1.1, + 1.3, + 0, + 0, + 0.2, + 0, + 0.1, + 0.1, + 1, + 0.7 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 22, + accommodation_costs: 12.25, + food_costs: 4, + water_costs: 0.3, + local_transportation_costs: 3.75, + entertainment_costs: 6.25, + alcohol_costs: 2.42, + scores: [ + { + type: 'temperature_mean_max', + value: 39.8, + score: 0 + }, + { + type: 'rain_days', + value: 0, + score: 9 + } + ], + score: 4.5 + }, + { + region_id: 2, + name: 'Melbourne', + country: 'Australia', + description: null, + temperature_mean_max: [ + 27.5, + 27.4, + 25.1, + 21.1, + 17, + 14, + 13.7, + 14.7, + 17.4, + 20.9, + 23.1, + 25.7 + ], + precipitation: [ + 34.8, + 38.9, + 39.3, + 40, + 35.4, + 51.4, + 33.4, + 33.8, + 47, + 50.8, + 67.3, + 65.7 + ], + rain_days: [ + 4.6, + 3.4, + 5.2, + 6.6, + 7.8, + 8, + 8.7, + 8.7, + 8.2, + 7.9, + 6.8, + 6.9 + ], + sun_hours: [ + 269.1, + 234.6, + 222.7, + 176.2, + 139, + 122.9, + 139.3, + 163.3, + 185.6, + 220.7, + 220, + 264.2 + ], + average_per_day_costs: 46.2, + accommodation_costs: 27.6, + food_costs: 8.4, + water_costs: 0.9, + local_transportation_costs: 5.68, + entertainment_costs: 7.8, + alcohol_costs: 3.99, + scores: [ + { + type: 'temperature_mean_max', + value: 15.2, + score: 3 + }, + { + type: 'rain_days', + value: 8, + score: 5.7 + } + ], + score: 4.35 + }, + { + region_id: 21, + name: 'Dublin', + country: 'Irland', + description: null, + temperature_mean_max: [ + 7.8, + 8.1, + 9.8, + 12.4, + 15.2, + 18.2, + 19.7, + 18.8, + 16.9, + 14, + 10.3, + 8.7 + ], + precipitation: [ + 68, + 48.4, + 61.3, + 47.8, + 52.7, + 58.1, + 56.2, + 74.6, + 61.6, + 76.6, + 84.6, + 76.2 + ], + rain_days: [ + 13.1, + 11.3, + 11.4, + 9.3, + 10.7, + 9.8, + 10.6, + 11.9, + 10.4, + 11.3, + 12.7, + 14.1 + ], + sun_hours: [ + 68.2, + 78.9, + 125.8, + 170.1, + 198.1, + 190.9, + 163.3, + 148.3, + 133.4, + 100.8, + 77, + 57.6 + ], + average_per_day_costs: 43, + accommodation_costs: 20, + food_costs: 14, + water_costs: 1.21, + local_transportation_costs: 5.65, + entertainment_costs: 8.15, + alcohol_costs: 5.61, + scores: [ + { + type: 'temperature_mean_max', + value: 17.2, + score: 5.1 + }, + { + type: 'rain_days', + value: 10.3, + score: 3.2 + } + ], + score: 4.15 + }, + { + region_id: 28, + name: 'Auckland', + country: 'New Zealand', + description: null, + temperature_mean_max: [ + 23.8, + 25.5, + 23.2, + 20.9, + 17.8, + 15.4, + 14.2, + 15.4, + 16.8, + 17.9, + 20.4, + 23.6 + ], + precipitation: [ + 47, + 5, + 8, + 56, + 163, + 161, + 88, + 187, + 112, + 20, + 22, + 96 + ], + rain_days: [ + 6, + 2, + 3, + 9, + 15, + 16, + 9, + 21, + 17, + 5, + 3, + 8 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 50, + accommodation_costs: 29, + food_costs: 12, + water_costs: 1.95, + local_transportation_costs: 6.8, + entertainment_costs: 6.82, + alcohol_costs: 5.45, + scores: [ + { + type: 'temperature_mean_max', + value: 16.2, + score: 4 + }, + { + type: 'rain_days', + value: 14.3, + score: 0.9 + } + ], + score: 2.45 + }, + { + region_id: 18, + name: 'Reykjavik', + country: 'Iceland', + description: null, + temperature_mean_max: [ + 3.7, + 4.2, + 5, + 7, + 10.3, + 13.5, + 15.3, + 14.6, + 11.7, + 8.1, + 5.2, + 3.1 + ], + precipitation: [ + 95.7, + 92.2, + 81, + 68.8, + 53.4, + 49.3, + 51, + 52.7, + 90, + 94.1, + 91, + 90.2 + ], + rain_days: [ + 15.7, + 14.7, + 15.3, + 13.1, + 10.4, + 9.8, + 10.9, + 9.4, + 15.9, + 14.9, + 13.9, + 14.6 + ], + sun_hours: [ + 22.7, + 60.2, + 107.8, + 160.3, + 208.9, + 171.3, + 178.1, + 183.4, + 125.6, + 89.1, + 38.9, + 14.3 + ], + average_per_day_costs: 67.39, + accommodation_costs: 32.3, + food_costs: 8.34, + water_costs: 0, + local_transportation_costs: 13.12, + entertainment_costs: 20.42, + alcohol_costs: 8.49, + scores: [ + { + type: 'temperature_mean_max', + value: 12.5, + score: 1.1 + }, + { + type: 'rain_days', + value: 10.3, + score: 3.3 + } + ], + score: 2.2 + }, + { + region_id: 24, + name: 'Kuala Lumpur', + country: 'Malaysia', + description: null, + temperature_mean_max: [ + 32.5, + 33.6, + 33.9, + 34.1, + 33.8, + 33.8, + 33.2, + 32.8, + 32.9, + 33, + 32.4, + 32.2 + ], + precipitation: [ + 229.4, + 172.8, + 250.9, + 295, + 301.9, + 137.9, + 150.2, + 201.8, + 250.7, + 281.8, + 380.6, + 293.8 + ], + rain_days: [ + 14.8, + 11.1, + 14.6, + 17, + 15.4, + 7.4, + 10, + 10.7, + 15.1, + 15.7, + 20.2, + 17 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 16.17, + accommodation_costs: 9.45, + food_costs: 3.57, + water_costs: 0.33, + local_transportation_costs: 1.6600000000000001, + entertainment_costs: 3.99, + alcohol_costs: 2.1, + scores: [ + { + type: 'temperature_mean_max', + value: 33.7, + score: 0 + }, + { + type: 'rain_days', + value: 11.2, + score: 3.2 + } + ], + score: 1.6 + }, + { + region_id: 44, + name: 'Miami', + country: 'USA', + description: null, + temperature_mean_max: [ + 24.7, + 26, + 27, + 29.2, + 30.6, + 32.1, + 32.7, + 32.7, + 32, + 30.1, + 27.6, + 26.2 + ], + precipitation: [ + 53.9, + 52.7, + 52, + 111.8, + 182.1, + 265.2, + 205.4, + 254.7, + 248.4, + 176, + 81.2, + 65.4 + ], + rain_days: [ + 5.8, + 4.6, + 4.6, + 6.4, + 9, + 14.1, + 14.6, + 16.1, + 15.2, + 10.7, + 7.6, + 5.9 + ], + sun_hours: [ + 190, + 215.8, + 255.2, + 258.4, + 251.8, + 216.3, + 229.8, + 245.2, + 208.7, + 175.7, + 154, + 188.5 + ], + average_per_day_costs: 60.06, + accommodation_costs: 39.13, + food_costs: 13.65, + water_costs: 0.27, + local_transportation_costs: 8.37, + entertainment_costs: 8.55, + alcohol_costs: 7.76, + scores: [ + { + type: 'temperature_mean_max', + value: 31.6, + score: 1.1 + }, + { + type: 'rain_days', + value: 12.1, + score: 1.9 + } + ], + score: 1.5 + }, + { + region_id: 33, + name: 'Singapur', + country: 'Singapur', + description: null, + temperature_mean_max: [ + 30.5, + 31.1, + 32.2, + 32.5, + 32.2, + 31.7, + 31.3, + 31.1, + 31.4, + 31.7, + 31.3, + 30.8 + ], + precipitation: [ + 189.2, + 98.5, + 136.8, + 148.8, + 161.1, + 139.9, + 143, + 149.7, + 128.1, + 169.8, + 245.4, + 286 + ], + rain_days: [ + 11.2, + 6.1, + 8.2, + 12.1, + 12.8, + 10.7, + 10.4, + 11.3, + 11, + 11.9, + 17.7, + 15.6 + ], + sun_hours: [ + 181.4, + 203.2, + 200.8, + 187.6, + 182.1, + 170.2, + 193.9, + 185.7, + 164.4, + 167.6, + 134.3, + 133.6 + ], + average_per_day_costs: 39, + accommodation_costs: 24.7, + food_costs: 7.8, + water_costs: 0.88, + local_transportation_costs: 2.87, + entertainment_costs: 9.1, + alcohol_costs: 7.8, + scores: [ + { + type: 'temperature_mean_max', + value: 31.8, + score: 0.9 + }, + { + type: 'rain_days', + value: 11.5, + score: 1.9 + } + ], + score: 1.4 + }, + { + region_id: 30, + name: 'Manila', + country: 'Philippines', + description: null, + temperature_mean_max: [ + 29.9, + 30.8, + 32.1, + 34, + 34.2, + 32.9, + 31.7, + 31.3, + 31.6, + 31.7, + 31.8, + 30.7 + ], + precipitation: [ + 27.4, + 29.8, + 30.6, + 17.8, + 111.8, + 344, + 447.4, + 576.3, + 460.2, + 252.6, + 90.9, + 123.4 + ], + rain_days: [ + 6.2, + 3, + 3.7, + 2.4, + 8.7, + 17.3, + 22.6, + 20.3, + 18.8, + 15.1, + 11.8, + 9.6 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 28.57, + accommodation_costs: 18.68, + food_costs: 2.61, + water_costs: 0.45, + local_transportation_costs: 2.27, + entertainment_costs: 2.4699999999999998, + alcohol_costs: 0.81, + scores: [ + { + type: 'temperature_mean_max', + value: 33.2, + score: 0.2 + }, + { + type: 'rain_days', + value: 14.7, + score: 2.1 + } + ], + score: 1.15 + }, + { + region_id: 40, + name: 'Bangkok', + country: 'Thailand', + description: null, + temperature_mean_max: [ + 32.6, + 33.8, + 34.7, + 35.9, + 35.9, + 34.5, + 33.7, + 33.7, + 33.6, + 33.1, + 33.6, + 32.6 + ], + precipitation: [ + 48.8, + 18.1, + 79, + 81.2, + 178.7, + 264.8, + 238.1, + 255.1, + 361.9, + 325.4, + 52.5, + 25.3 + ], + rain_days: [ + 3.8, + 2, + 4, + 5.1, + 11.3, + 14.3, + 16.3, + 17.1, + 19.8, + 16.1, + 5, + 1.8 + ], + sun_hours: [ + 203.4, + 203.8, + 221.1, + 214.5, + 185.1, + 145.8, + 120.7, + 116.4, + 136.6, + 145.9, + 177.8, + 198.6 + ], + average_per_day_costs: 22.12, + accommodation_costs: 11.96, + food_costs: 5.54, + water_costs: 0.42, + local_transportation_costs: 1.43, + entertainment_costs: 4.06, + alcohol_costs: 2.52, + scores: [ + { + type: 'temperature_mean_max', + value: 34.9, + score: 0 + }, + { + type: 'rain_days', + value: 13.4, + score: 0.9 + } + ], + score: 0.45 + } +]; + +export const MOCK_REGIONS: Region[] = [ + { + region_id: 2, + name: 'Melbourne', + country: 'Australia', + description: null, + temperature_mean_max: [ + 27.5, + 27.4, + 25.1, + 21.1, + 17, + 14, + 13.7, + 14.7, + 17.4, + 20.9, + 23.1, + 25.7 + ], + precipitation: [ + 34.8, + 38.9, + 39.3, + 40, + 35.4, + 51.4, + 33.4, + 33.8, + 47, + 50.8, + 67.3, + 65.7 + ], + rain_days: [ + 4.6, + 3.4, + 5.2, + 6.6, + 7.8, + 8, + 8.7, + 8.7, + 8.2, + 7.9, + 6.8, + 6.9 + ], + sun_hours: [ + 269.1, + 234.6, + 222.7, + 176.2, + 139, + 122.9, + 139.3, + 163.3, + 185.6, + 220.7, + 220, + 264.2 + ], + average_per_day_costs: 46.2, + accommodation_costs: 27.6, + food_costs: 8.4, + water_costs: 0.9, + local_transportation_costs: 5.68, + entertainment_costs: 7.8, + alcohol_costs: 3.99 + }, + { + region_id: 3, + name: 'Sydney', + country: 'Australia', + description: null, + temperature_mean_max: [ + 28.3, + 27.7, + 26.5, + 23.8, + 21.2, + 18.3, + 18.4, + 19.3, + 22.1, + 24, + 25.4, + 27.1 + ], + precipitation: [ + 84.8, + 91.3, + 127.2, + 123.9, + 59.2, + 154.7, + 68.2, + 64.2, + 45.4, + 61.8, + 85.8, + 72.8 + ], + rain_days: [ + 7.6, + 7.4, + 10.7, + 9.8, + 5.6, + 9.4, + 6.7, + 5.7, + 6, + 7.9, + 8.1, + 7.4 + ], + sun_hours: [ + 235.6, + 206.1, + 202.8, + 208.9, + 218.4, + 160, + 221, + 255.7, + 241.5, + 240, + 232.1, + 239.7 + ], + average_per_day_costs: 43.2, + accommodation_costs: 25.2, + food_costs: 10.2, + water_costs: 1.04, + local_transportation_costs: 4.03, + entertainment_costs: 9, + alcohol_costs: 4.42 + }, + { + region_id: 6, + name: 'Sao Paolo', + country: 'Brazil', + description: null, + temperature_mean_max: [ + 27.1, + 28.1, + 27.6, + 26.4, + 22.8, + 21.8, + 22.5, + 23.3, + 25.2, + 25.2, + 25.3, + 27.9 + ], + precipitation: [ + 156.3, + 108.7, + 129.3, + 39.5, + 42.3, + 48.8, + 19.4, + 21.3, + 19.6, + 62, + 98.8, + 96.5 + ], + rain_days: [ + 13, + 8.7, + 11.3, + 3.3, + 5, + 4.5, + 2.8, + 3.4, + 3, + 8.8, + 9.5, + 9 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 13.6, + accommodation_costs: 6.97, + food_costs: 4.42, + water_costs: 0.65, + local_transportation_costs: 1.67, + entertainment_costs: 1.23, + alcohol_costs: 1.08 + }, + { + region_id: 7, + name: 'Toronto', + country: 'Canada', + description: null, + temperature_mean_max: [ + -2.2, + -0.4, + 6.4, + 14, + 21.5, + 23.8, + 28.5, + 27.4, + 21.2, + 14.9, + 9, + -0.8 + ], + precipitation: [ + 33, + 36, + 76.5, + 67.5, + 52, + 192, + 90, + 60, + 88, + 58, + 59, + 38 + ], + rain_days: [ + 8, + 8.5, + 8.5, + 8, + 11, + 14, + 7, + 6, + 10, + 9, + 7, + 5 + ], + sun_hours: [ + 91.5, + 91.5, + 183.5, + 191, + 268, + 253, + 308, + 265, + 189, + 160, + 138, + 67 + ], + average_per_day_costs: 48.18, + accommodation_costs: 21.78, + food_costs: 13.2, + water_costs: 0.85, + local_transportation_costs: 7.26, + entertainment_costs: 7.92, + alcohol_costs: 6.42 + }, + { + region_id: 8, + name: 'Santiago de Chile', + country: 'Chile', + description: null, + temperature_mean_max: [ + 11.3, + 11.6, + 14.7, + 17.8, + 19.9, + 23, + 25.1, + 25.5, + 23.7, + 20, + 14, + 12.5 + ], + precipitation: [ + 217.4, + 196.7, + 146.4, + 112.3, + 87.4, + 55.1, + 30.3, + 38.3, + 50.1, + 164.2, + 182, + 164.6 + ], + rain_days: [ + 15.9, + 15, + 14.3, + 13.1, + 9.1, + 6.7, + 4.7, + 5.6, + 5.1, + 11.1, + 15.3, + 12.9 + ], + sun_hours: [ + 83.4, + 101.2, + 146.4, + 180.7, + 204.6, + 214.9, + 242.8, + 241.9, + 194, + 164.4, + 102.3, + 97.4 + ], + average_per_day_costs: 42.64, + accommodation_costs: 33.1, + food_costs: 3.91, + water_costs: 0.52, + local_transportation_costs: 1.5699999999999998, + entertainment_costs: 11.63, + alcohol_costs: 2.52 + }, + { + region_id: 9, + name: 'Peking', + country: 'China', + description: null, + temperature_mean_max: [ + 1.8, + 5.4, + 13.4, + 21.3, + 28, + 30.9, + 32.2, + 31.3, + 26.3, + 19.1, + 10.3, + 3.8 + ], + precipitation: [ + 1.7, + 5.2, + 7.4, + 22.6, + 26.7, + 85, + 199.9, + 120.1, + 66.6, + 33.4, + 15.7, + 1.6 + ], + rain_days: [ + 0.2, + 1.7, + 1.3, + 3.1, + 3.3, + 7.9, + 8.6, + 7.1, + 5.2, + 3.4, + 1.7, + 0.4 + ], + sun_hours: [ + 190.2, + 174.3, + 226.4, + 240.4, + 261.5, + 209.2, + 174.9, + 211.9, + 200.6, + 180.2, + 166.3, + 181.1 + ], + average_per_day_costs: 19.24, + accommodation_costs: 10.4, + food_costs: 4.55, + water_costs: 0.34, + local_transportation_costs: 1.12, + entertainment_costs: 5.85, + alcohol_costs: 1.95 + }, + { + region_id: 10, + name: 'Shanghai', + country: 'China', + description: null, + temperature_mean_max: [ + 8.4, + 9.9, + 14.8, + 20.8, + 25.5, + 27.5, + 33.3, + 32.6, + 27.9, + 22.9, + 17.6, + 10.9 + ], + precipitation: [ + 49.1, + 66.3, + 83, + 91.7, + 105.9, + 199.4, + 125.9, + 192.9, + 162.3, + 106.3, + 64.2, + 57.7 + ], + rain_days: [ + 5.9, + 7.4, + 9.4, + 8.6, + 8.6, + 10.6, + 8.2, + 10.8, + 8.6, + 5.9, + 7.8, + 6.4 + ], + sun_hours: [ + 111.5, + 106.2, + 143.8, + 166.7, + 165.9, + 94.1, + 183.6, + 176.2, + 137.6, + 141, + 111, + 125.8 + ], + average_per_day_costs: 32.24, + accommodation_costs: 21.32, + food_costs: 6.5, + water_costs: 0.32, + local_transportation_costs: 1.1400000000000001, + entertainment_costs: 2.34, + alcohol_costs: 2.21 + }, + { + region_id: 11, + name: 'Bogota', + country: 'Colombia', + description: null, + temperature_mean_max: [ + 20.5, + 19.8, + 19.9, + 19.1, + 19.5, + 18.6, + 18.7, + 19.1, + 19, + 19.6, + 19.3, + 19.8 + ], + precipitation: [ + 29, + 56, + 78, + 146.5, + 108, + 57.8, + 55.3, + 47, + 63.3, + 107.3, + 121.7, + 59.7 + ], + rain_days: [ + 4.4, + 6.8, + 9.1, + 14, + 13.3, + 9.8, + 9.7, + 7.6, + 8.4, + 12.2, + 12.6, + 6.8 + ], + sun_hours: [ + 206.1, + 141, + 119.6, + 105.2, + 103.6, + 121.6, + 129.2, + 128.4, + 116, + 120.5, + 113.8, + 159.7 + ], + average_per_day_costs: 12.61, + accommodation_costs: 6.75, + food_costs: 2.7199999999999998, + water_costs: 0.36, + local_transportation_costs: 1.7, + entertainment_costs: 1.69, + alcohol_costs: 1.9 + }, + { + region_id: 12, + name: 'Kairo', + country: 'Egypt', + description: null, + temperature_mean_max: [ + 19, + 21.5, + 24.8, + 28.4, + 32.5, + 34.6, + 34.9, + 35.3, + 33.6, + 29.9, + 25, + 20.5 + ], + precipitation: [ + 4.5, + 3.3, + 2.4, + 3.4, + 0.1, + 0, + 0, + 0, + 0, + 0.1, + 2.4, + 3.2 + ], + rain_days: [ + 1.5, + 0.8, + 0.3, + 0.4, + 0, + 0, + 0, + 0, + 0, + 0, + 0.8, + 0.8 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 9.16, + accommodation_costs: 6.09, + food_costs: 1.33, + water_costs: 0.13, + local_transportation_costs: 1.45, + entertainment_costs: 3.07, + alcohol_costs: 0.7 + }, + { + region_id: 13, + name: 'London', + country: 'England', + description: null, + temperature_mean_max: [ + 7.9, + 8.3, + 11.6, + 15.4, + 18.4, + 21.8, + 24.4, + 22.9, + 20.3, + 16.3, + 11.4, + 9.1 + ], + precipitation: [ + 70, + 47.7, + 40, + 38.7, + 47, + 45.7, + 45.3, + 63.4, + 39.4, + 49, + 61.7, + 56.2 + ], + rain_days: [ + 13.2, + 9.9, + 9.1, + 8, + 8, + 7.6, + 7.7, + 9.6, + 7.2, + 9.6, + 11, + 10.9 + ], + sun_hours: [ + 54.2, + 68.2, + 120.6, + 171.7, + 188, + 180.8, + 204, + 166.8, + 146.9, + 104.3, + 61.6, + 48.3 + ], + average_per_day_costs: 59, + accommodation_costs: 38, + food_costs: 12, + water_costs: 0.83, + local_transportation_costs: 5.98, + entertainment_costs: 18, + alcohol_costs: 4.07 + }, + { + region_id: 15, + name: 'Berlin', + country: 'Germany', + description: null, + temperature_mean_max: [ + 2.5, + 4.1, + 9.3, + 15.5, + 19.9, + 23.2, + 25.5, + 24.9, + 20.3, + 14.2, + 8.3, + 5 + ], + precipitation: [ + 43.3, + 19.8, + 26.1, + 25.8, + 42.7, + 66.6, + 86.1, + 46.9, + 43.7, + 41.9, + 42.2, + 41.4 + ], + rain_days: [ + 10.9, + 5.8, + 7.4, + 6.2, + 6.6, + 7.7, + 9.6, + 7.7, + 7.9, + 8.7, + 8.3, + 11 + ], + sun_hours: [ + 38, + 86.4, + 140, + 188.1, + 221.3, + 230, + 246.7, + 221.1, + 174, + 116.2, + 58.1, + 36.3 + ], + average_per_day_costs: 38, + accommodation_costs: 18, + food_costs: 15, + water_costs: 0.5, + local_transportation_costs: 5.03, + entertainment_costs: 5.25, + alcohol_costs: 4.24 + }, + { + region_id: 16, + name: 'Athen', + country: 'Greece', + description: null, + temperature_mean_max: [ + 13.6, + 15.2, + 17.5, + 22.1, + 26.8, + 31.3, + 34.6, + 34.6, + 30.9, + 23.8, + 19.4, + 14.9 + ], + precipitation: [ + 53.1, + 66.7, + 36.7, + 14.2, + 23.1, + 24.8, + 9.6, + 0.9, + 28.2, + 37.7, + 60.1, + 63 + ], + rain_days: [ + 6.9, + 6.3, + 5.1, + 2.1, + 2.9, + 3.6, + 0.6, + 0.4, + 2, + 3.7, + 5.1, + 5.7 + ], + sun_hours: [ + 133.6, + 130, + 209, + 269, + 287.8, + 336.8, + 395, + 367.3, + 282, + 200, + 139.3, + 124.8 + ], + average_per_day_costs: 29, + accommodation_costs: 16, + food_costs: 7.9, + water_costs: 0.91, + local_transportation_costs: 4.96, + entertainment_costs: 5.22, + alcohol_costs: 3.95 + }, + { + region_id: 18, + name: 'Reykjavik', + country: 'Iceland', + description: null, + temperature_mean_max: [ + 3.7, + 4.2, + 5, + 7, + 10.3, + 13.5, + 15.3, + 14.6, + 11.7, + 8.1, + 5.2, + 3.1 + ], + precipitation: [ + 95.7, + 92.2, + 81, + 68.8, + 53.4, + 49.3, + 51, + 52.7, + 90, + 94.1, + 91, + 90.2 + ], + rain_days: [ + 15.7, + 14.7, + 15.3, + 13.1, + 10.4, + 9.8, + 10.9, + 9.4, + 15.9, + 14.9, + 13.9, + 14.6 + ], + sun_hours: [ + 22.7, + 60.2, + 107.8, + 160.3, + 208.9, + 171.3, + 178.1, + 183.4, + 125.6, + 89.1, + 38.9, + 14.3 + ], + average_per_day_costs: 67.39, + accommodation_costs: 32.3, + food_costs: 8.34, + water_costs: 0, + local_transportation_costs: 13.12, + entertainment_costs: 20.42, + alcohol_costs: 8.49 + }, + { + region_id: 21, + name: 'Dublin', + country: 'Irland', + description: null, + temperature_mean_max: [ + 7.8, + 8.1, + 9.8, + 12.4, + 15.2, + 18.2, + 19.7, + 18.8, + 16.9, + 14, + 10.3, + 8.7 + ], + precipitation: [ + 68, + 48.4, + 61.3, + 47.8, + 52.7, + 58.1, + 56.2, + 74.6, + 61.6, + 76.6, + 84.6, + 76.2 + ], + rain_days: [ + 13.1, + 11.3, + 11.4, + 9.3, + 10.7, + 9.8, + 10.6, + 11.9, + 10.4, + 11.3, + 12.7, + 14.1 + ], + sun_hours: [ + 68.2, + 78.9, + 125.8, + 170.1, + 198.1, + 190.9, + 163.3, + 148.3, + 133.4, + 100.8, + 77, + 57.6 + ], + average_per_day_costs: 43, + accommodation_costs: 20, + food_costs: 14, + water_costs: 1.21, + local_transportation_costs: 5.65, + entertainment_costs: 8.15, + alcohol_costs: 5.61 + }, + { + region_id: 23, + name: 'Tokio', + country: 'Japan', + description: null, + temperature_mean_max: [ + 10, + 10.6, + 14.4, + 19.4, + 24.3, + 26.4, + 31, + 31.9, + 27.9, + 22.5, + 17.1, + 12.2 + ], + precipitation: [ + 45.7, + 78.1, + 113.9, + 149.7, + 132.4, + 168.2, + 109.1, + 138.6, + 292.4, + 228.8, + 97.3, + 69.2 + ], + rain_days: [ + 3.6, + 6.1, + 8.7, + 9.1, + 9, + 12.2, + 9.9, + 8.3, + 13.1, + 10.3, + 8.1, + 6 + ], + sun_hours: [ + 209.2, + 157.6, + 182.7, + 180, + 207.3, + 139.8, + 181.2, + 179.6, + 135.3, + 128.8, + 148.1, + 181 + ], + average_per_day_costs: 43.81, + accommodation_costs: 21.53, + food_costs: 11.62, + water_costs: 0.51, + local_transportation_costs: 4.48, + entertainment_costs: 8.98, + alcohol_costs: 11.85 + }, + { + region_id: 24, + name: 'Kuala Lumpur', + country: 'Malaysia', + description: null, + temperature_mean_max: [ + 32.5, + 33.6, + 33.9, + 34.1, + 33.8, + 33.8, + 33.2, + 32.8, + 32.9, + 33, + 32.4, + 32.2 + ], + precipitation: [ + 229.4, + 172.8, + 250.9, + 295, + 301.9, + 137.9, + 150.2, + 201.8, + 250.7, + 281.8, + 380.6, + 293.8 + ], + rain_days: [ + 14.8, + 11.1, + 14.6, + 17, + 15.4, + 7.4, + 10, + 10.7, + 15.1, + 15.7, + 20.2, + 17 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 16.17, + accommodation_costs: 9.45, + food_costs: 3.57, + water_costs: 0.33, + local_transportation_costs: 1.6600000000000001, + entertainment_costs: 3.99, + alcohol_costs: 2.1 + }, + { + region_id: 26, + name: 'Marrakesch', + country: 'Morocco', + description: null, + temperature_mean_max: [ + 19.6, + 20.1, + 23.5, + 26.6, + 29.9, + 34, + 38, + 38.7, + 32.9, + 29.6, + 23.2, + 21.2 + ], + precipitation: [ + 25.9, + 19.3, + 29, + 24.8, + 15.9, + 2.2, + 2.8, + 11, + 20.7, + 17.7, + 43.9, + 12.8 + ], + rain_days: [ + 3.8, + 3.7, + 4.1, + 3.1, + 2.4, + 0.4, + 0.4, + 1.6, + 1.4, + 2.3, + 5.3, + 2.2 + ], + sun_hours: [ + 234, + 234.9, + 263.6, + 280.2, + 292.1, + 327.3, + 333.2, + 304.3, + 263.4, + 245.6, + 217.1, + 242.2 + ], + average_per_day_costs: 19.07, + accommodation_costs: 12.28, + food_costs: 3.91, + water_costs: 0.62, + local_transportation_costs: 1.8599999999999999, + entertainment_costs: 2.14, + alcohol_costs: 4.74 + }, + { + region_id: 28, + name: 'Auckland', + country: 'New Zealand', + description: null, + temperature_mean_max: [ + 23.8, + 25.5, + 23.2, + 20.9, + 17.8, + 15.4, + 14.2, + 15.4, + 16.8, + 17.9, + 20.4, + 23.6 + ], + precipitation: [ + 47, + 5, + 8, + 56, + 163, + 161, + 88, + 187, + 112, + 20, + 22, + 96 + ], + rain_days: [ + 6, + 2, + 3, + 9, + 15, + 16, + 9, + 21, + 17, + 5, + 3, + 8 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 50, + accommodation_costs: 29, + food_costs: 12, + water_costs: 1.95, + local_transportation_costs: 6.8, + entertainment_costs: 6.82, + alcohol_costs: 5.45 + }, + { + region_id: 29, + name: 'Lima', + country: 'Peru', + description: null, + temperature_mean_max: [ + 26.7, + 27.9, + 27.3, + 25, + 22.8, + 20.9, + 19.3, + 18.7, + 19.4, + 20.7, + 22.3, + 24.4 + ], + precipitation: [ + 0.6, + 0.9, + 0.4, + 0.3, + 0.4, + 0.6, + 0.9, + 0.7, + 0.7, + 0.5, + 0.4, + 0.4 + ], + rain_days: [ + 0.2, + 0.4, + 0.1, + 0, + 0, + 0, + 0.1, + 0, + 0.1, + 0.1, + 0, + 0.1 + ], + sun_hours: [ + 161, + 158.8, + 183.1, + 189.8, + 91.4, + 33.9, + 23.7, + 22.3, + 38.1, + 59.3, + 80.4, + 127.4 + ], + average_per_day_costs: 20.79, + accommodation_costs: 12.42, + food_costs: 5.4, + water_costs: 0.43, + local_transportation_costs: 1.72, + entertainment_costs: 2.44, + alcohol_costs: 1.49 + }, + { + region_id: 30, + name: 'Manila', + country: 'Philippines', + description: null, + temperature_mean_max: [ + 29.9, + 30.8, + 32.1, + 34, + 34.2, + 32.9, + 31.7, + 31.3, + 31.6, + 31.7, + 31.8, + 30.7 + ], + precipitation: [ + 27.4, + 29.8, + 30.6, + 17.8, + 111.8, + 344, + 447.4, + 576.3, + 460.2, + 252.6, + 90.9, + 123.4 + ], + rain_days: [ + 6.2, + 3, + 3.7, + 2.4, + 8.7, + 17.3, + 22.6, + 20.3, + 18.8, + 15.1, + 11.8, + 9.6 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 28.57, + accommodation_costs: 18.68, + food_costs: 2.61, + water_costs: 0.45, + local_transportation_costs: 2.27, + entertainment_costs: 2.4699999999999998, + alcohol_costs: 0.81 + }, + { + region_id: 33, + name: 'Singapur', + country: 'Singapur', + description: null, + temperature_mean_max: [ + 30.5, + 31.1, + 32.2, + 32.5, + 32.2, + 31.7, + 31.3, + 31.1, + 31.4, + 31.7, + 31.3, + 30.8 + ], + precipitation: [ + 189.2, + 98.5, + 136.8, + 148.8, + 161.1, + 139.9, + 143, + 149.7, + 128.1, + 169.8, + 245.4, + 286 + ], + rain_days: [ + 11.2, + 6.1, + 8.2, + 12.1, + 12.8, + 10.7, + 10.4, + 11.3, + 11, + 11.9, + 17.7, + 15.6 + ], + sun_hours: [ + 181.4, + 203.2, + 200.8, + 187.6, + 182.1, + 170.2, + 193.9, + 185.7, + 164.4, + 167.6, + 134.3, + 133.6 + ], + average_per_day_costs: 39, + accommodation_costs: 24.7, + food_costs: 7.8, + water_costs: 0.88, + local_transportation_costs: 2.87, + entertainment_costs: 9.1, + alcohol_costs: 7.8 + }, + { + region_id: 34, + name: 'Johannesburg', + country: 'South Africa', + description: null, + temperature_mean_max: [ + 26, + 26.1, + 24.9, + 21.8, + 20.4, + 17.5, + 17.3, + 20.4, + 24.4, + 25.4, + 25.6, + 26 + ], + precipitation: [ + 124.3, + 73.2, + 89.8, + 50.8, + 20, + 4.1, + 2.8, + 1.3, + 16, + 57.3, + 99.4, + 145.8 + ], + rain_days: [ + 9.4, + 9.4, + 8.4, + 5.7, + 1.8, + 0.5, + 0.6, + 0.4, + 1.9, + 7, + 11, + 14 + ], + sun_hours: [ + 226.7, + 218.4, + 220, + 216.5, + 266.5, + 268.8, + 277.1, + 299.2, + 278.3, + 289, + 253.6, + 228.4 + ], + average_per_day_costs: 32, + accommodation_costs: 15.44, + food_costs: 5.24, + water_costs: 0.74, + local_transportation_costs: 4.9, + entertainment_costs: 5.49, + alcohol_costs: 1.47 + }, + { + region_id: 35, + name: 'Kapstadt', + country: 'South Africa', + description: null, + temperature_mean_max: [ + 27.5, + 27.4, + 26, + 24.1, + 20.7, + 17.9, + 18.1, + 18.3, + 19.7, + 22.8, + 24, + 26.4 + ], + precipitation: [ + 9, + 7.9, + 16.4, + 30, + 46.2, + 89.4, + 63.1, + 69.1, + 36.8, + 15.8, + 26.8, + 11.3 + ], + rain_days: [ + 1.8, + 1.6, + 3.1, + 4.3, + 7.2, + 10.2, + 7.2, + 9.4, + 6.3, + 4.3, + 4, + 2.7 + ], + sun_hours: [ + 354.3, + 311.3, + 286.8, + 251.1, + 196, + 169.8, + 206.4, + 206, + 227.3, + 291, + 313.4, + 351.3 + ], + average_per_day_costs: 38.66, + accommodation_costs: 10.14, + food_costs: 23.47, + water_costs: 0.21, + local_transportation_costs: 4.9, + entertainment_costs: 6.03, + alcohol_costs: 13.67 + }, + { + region_id: 36, + name: 'Seoul', + country: 'South Korea', + description: null, + temperature_mean_max: [ + 1, + 4.7, + 11.2, + 17.7, + 24.3, + 28.5, + 29.7, + 30.8, + 26.7, + 20.6, + 12, + 3.2 + ], + precipitation: [ + 12.9, + 32, + 31.7, + 87, + 89.8, + 127, + 454.9, + 243.7, + 144.4, + 58.7, + 51.8, + 27.6 + ], + rain_days: [ + 2.8, + 3.2, + 4.2, + 8, + 6.4, + 6.8, + 13.6, + 12, + 5.9, + 4.4, + 7.7, + 4.7 + ], + sun_hours: [ + 190.6, + 184.8, + 225, + 214, + 250.7, + 225, + 141.8, + 173.4, + 202.8, + 226.2, + 166.3, + 183.1 + ], + average_per_day_costs: 45.15, + accommodation_costs: 29.34, + food_costs: 9.13, + water_costs: 0.68, + local_transportation_costs: 3.88, + entertainment_costs: 7.66, + alcohol_costs: 3.15 + }, + { + region_id: 37, + name: 'Barcelona', + country: 'Spain', + description: null, + temperature_mean_max: [ + 14.3, + 14.2, + 16.6, + 19.1, + 22.1, + 26.2, + 29, + 29.6, + 26.6, + 23.1, + 18.5, + 15.3 + ], + precipitation: [ + 25, + 43.7, + 64.3, + 39.2, + 37.8, + 27.8, + 26.6, + 35.5, + 60.7, + 87.7, + 61.6, + 11.9 + ], + rain_days: [ + 4, + 4.3, + 5.3, + 5.6, + 4.1, + 2.8, + 2.3, + 3.4, + 5.9, + 6.9, + 5, + 2.2 + ], + sun_hours: [ + 91.2, + 133.2, + 211.2, + 207.8, + 234.8, + 251.8, + 262.8, + 257.8, + 191.4, + 159.2, + 89.8, + 77.8 + ], + average_per_day_costs: 44, + accommodation_costs: 26, + food_costs: 9.5, + water_costs: 0.6, + local_transportation_costs: 5.45, + entertainment_costs: 7.91, + alcohol_costs: 3.88 + }, + { + region_id: 38, + name: 'Madrid', + country: 'Spain', + description: null, + temperature_mean_max: [ + 11.3, + 12.3, + 15.9, + 19.9, + 24.4, + 30.3, + 34.2, + 33.8, + 28.9, + 22.6, + 15.1, + 12.1 + ], + precipitation: [ + 29.6, + 36, + 50.8, + 46.2, + 30.2, + 21.5, + 13.7, + 6.1, + 16.1, + 47.6, + 48.6, + 21.9 + ], + rain_days: [ + 5.4, + 5.2, + 7.2, + 7.3, + 5.1, + 3.8, + 1.2, + 1.1, + 2, + 6.1, + 6.9, + 3.6 + ], + sun_hours: [ + 149.6, + 157.7, + 201.2, + 232.4, + 282.2, + 329.4, + 385.8, + 346.2, + 267.8, + 214.9, + 149.9, + 160.1 + ], + average_per_day_costs: 37, + accommodation_costs: 21, + food_costs: 9.27, + water_costs: 0.6, + local_transportation_costs: 5.5600000000000005, + entertainment_costs: 8.47, + alcohol_costs: 4.18 + }, + { + region_id: 40, + name: 'Bangkok', + country: 'Thailand', + description: null, + temperature_mean_max: [ + 32.6, + 33.8, + 34.7, + 35.9, + 35.9, + 34.5, + 33.7, + 33.7, + 33.6, + 33.1, + 33.6, + 32.6 + ], + precipitation: [ + 48.8, + 18.1, + 79, + 81.2, + 178.7, + 264.8, + 238.1, + 255.1, + 361.9, + 325.4, + 52.5, + 25.3 + ], + rain_days: [ + 3.8, + 2, + 4, + 5.1, + 11.3, + 14.3, + 16.3, + 17.1, + 19.8, + 16.1, + 5, + 1.8 + ], + sun_hours: [ + 203.4, + 203.8, + 221.1, + 214.5, + 185.1, + 145.8, + 120.7, + 116.4, + 136.6, + 145.9, + 177.8, + 198.6 + ], + average_per_day_costs: 22.12, + accommodation_costs: 11.96, + food_costs: 5.54, + water_costs: 0.42, + local_transportation_costs: 1.43, + entertainment_costs: 4.06, + alcohol_costs: 2.52 + }, + { + region_id: 42, + name: 'Chicago', + country: 'USA', + description: null, + temperature_mean_max: [ + -0.4, + 1.4, + 8.5, + 14.8, + 21.8, + 27.1, + 29.4, + 28.4, + 24.3, + 17.4, + 9.1, + 2.7 + ], + precipitation: [ + 48.2, + 58.1, + 58.8, + 100.3, + 135.7, + 128.6, + 129.7, + 93, + 66.9, + 88, + 60.9, + 58.1 + ], + rain_days: [ + 7.1, + 7.6, + 7.6, + 9.4, + 11.2, + 9.6, + 7.7, + 8.1, + 6.9, + 8.1, + 7, + 8 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 59.15, + accommodation_costs: 36.4, + food_costs: 11.83, + water_costs: 1.46, + local_transportation_costs: 10.92, + entertainment_costs: 10.01, + alcohol_costs: 6.49 + }, + { + region_id: 44, + name: 'Miami', + country: 'USA', + description: null, + temperature_mean_max: [ + 24.7, + 26, + 27, + 29.2, + 30.6, + 32.1, + 32.7, + 32.7, + 32, + 30.1, + 27.6, + 26.2 + ], + precipitation: [ + 53.9, + 52.7, + 52, + 111.8, + 182.1, + 265.2, + 205.4, + 254.7, + 248.4, + 176, + 81.2, + 65.4 + ], + rain_days: [ + 5.8, + 4.6, + 4.6, + 6.4, + 9, + 14.1, + 14.6, + 16.1, + 15.2, + 10.7, + 7.6, + 5.9 + ], + sun_hours: [ + 190, + 215.8, + 255.2, + 258.4, + 251.8, + 216.3, + 229.8, + 245.2, + 208.7, + 175.7, + 154, + 188.5 + ], + average_per_day_costs: 60.06, + accommodation_costs: 39.13, + food_costs: 13.65, + water_costs: 0.27, + local_transportation_costs: 8.37, + entertainment_costs: 8.55, + alcohol_costs: 7.76 + }, + { + region_id: 46, + name: 'San Francisco', + country: 'USA', + description: null, + temperature_mean_max: [ + 14.6, + 16.2, + 17.4, + 18.8, + 19.6, + 21.6, + 22.3, + 22, + 23.5, + 22.5, + 17.7, + 14.4 + ], + precipitation: [ + 82.1, + 65.9, + 76.8, + 41.1, + 3.6, + 5.5, + 0, + 0, + 2.7, + 17.4, + 55.7, + 93.7 + ], + rain_days: [ + 7, + 6.7, + 8.4, + 5, + 1, + 0.8, + 0, + 0, + 0.3, + 2.7, + 5.6, + 7.6 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 61.88, + accommodation_costs: 37.31, + food_costs: 11.83, + water_costs: 1.9300000000000002, + local_transportation_costs: 4.43, + entertainment_costs: 10.92, + alcohol_costs: 5.51 + }, + { + region_id: 47, + name: 'Dubai', + country: 'VAE', + description: null, + temperature_mean_max: [ + 24.6, + 26.5, + 29.1, + 33.9, + 38.1, + 40.4, + 42.5, + 41.7, + 40.2, + 36.1, + 30.6, + 26.5 + ], + precipitation: [ + 7.9, + 6.8, + 9.9, + 6.7, + 0.2, + 0, + 0.2, + 0.2, + 0.1, + 0.5, + 13.6, + 2.9 + ], + rain_days: [ + 1, + 1.5, + 1.1, + 1.3, + 0, + 0, + 0.2, + 0, + 0.1, + 0.1, + 1, + 0.7 + ], + sun_hours: [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + average_per_day_costs: 22, + accommodation_costs: 12.25, + food_costs: 4, + water_costs: 0.3, + local_transportation_costs: 3.75, + entertainment_costs: 6.25, + alcohol_costs: 2.42 + } +]; + +export const MOCK_PRESETS: Preset[] = [ + { + preset_id: 1, + parameter: 'temperature', + tag_label: 'warm', + value: [ + 20, + 25 + ] + }, + { + preset_id: 2, + parameter: 'temperature', + tag_label: 'chilly', + value: [ + 0, + 5 + ] + }, + { + preset_id: 3, + parameter: 'temperature', + tag_label: 'mild', + value: [ + 10, + 15 + ] + }, + { + preset_id: 4, + parameter: 'temperature', + tag_label: 'hot', + value: [ + 30, + 50 + ] + }, + { + preset_id: 5, + parameter: 'temperature', + tag_label: 'cold', + value: [ + -30, + -5 + ] + }, + { + preset_id: 6, + parameter: 'sun_hours', + tag_label: 'sunny', + value: [ + 250, + 500 + ] + }, + { + preset_id: 7, + parameter: 'sun_hours', + tag_label: 'dark', + value: [ + 0, + 50 + ] + }, + { + preset_id: 8, + parameter: 'precipitation', + tag_label: 'almost_no_rain', + value: [ + 0, + 5 + ] + }, + { + preset_id: 9, + parameter: 'precipitation', + tag_label: 'little_rain', + value: [ + 5, + 50 + ] + }, + { + preset_id: 10, + parameter: 'precipitation', + tag_label: 'floodlike_rain', + value: [ + 500, + 2000 + ] + }, + { + preset_id: 11, + parameter: 'rain_days', + tag_label: 'few_raindays', + value: [ + 0, + 2 + ] + }, + { + preset_id: 12, + parameter: 'rain_days', + tag_label: 'many_raindays', + value: [ + 20, + 31 + ] + }, + { + preset_id: 13, + parameter: 'alcohol_costs', + tag_label: 'cheap_alcohol', + value: [ + 0, + 3 + ] + }, + { + preset_id: 14, + parameter: 'food_costs', + tag_label: 'cheap_food', + value: [ + 0, + 3 + ] + }, + { + preset_id: 15, + parameter: 'water_costs', + tag_label: 'cheap_water', + value: [ + 0, + 0.5 + ] + }, + { + preset_id: 16, + parameter: 'local_transportation_costs', + tag_label: 'cheap_transportations', + value: [ + 0, + 4 + ] + }, + { + preset_id: 17, + parameter: 'entertainment_costs', + tag_label: 'cheap_entertainment', + value: [ + 0, + 4 + ] + } +]; diff --git a/frontend/src/app/services/data.service.ts b/frontend/src/app/services/data.service.ts index e29dbdf..4833762 100644 --- a/frontend/src/app/services/data.service.ts +++ b/frontend/src/app/services/data.service.ts @@ -3,13 +3,14 @@ import {HttpClient, HttpParams} from '@angular/common/http'; import {Preset} from '../interfaces/preset.interface'; import {Result} from '../interfaces/result.interface'; import {Region} from '../interfaces/region.interface'; +import {MOCK_PRESETS, MOCK_REGIONS, MOCK_RESULT} from '../mock/mock-data'; @Injectable({ providedIn: 'root' }) export class DataService { - private readonly API_URL = 'https://example.com/api/v1/'; + private readonly API_URL = 'https://example.com/api/v1'; constructor(private http: HttpClient) { } @@ -18,18 +19,27 @@ export class DataService { const params = new HttpParams(); params.append('q', query); - return this.http.get(this.API_URL + 'search', {params}).toPromise(); + // return this.http.get(this.API_URL + '/search', {params}).toPromise(); + return new Promise(resolve => { + resolve(MOCK_RESULT); + }); } public getAllPresets(): Promise { - return this.http.get(this.API_URL + 'preset').toPromise(); + // return this.http.get(this.API_URL + '/search/presets').toPromise(); + return new Promise(resolve => { + resolve(MOCK_PRESETS); + }); } public getAllRegions(): Promise { - return this.http.get(this.API_URL + 'region').toPromise(); + // return this.http.get(this.API_URL + '/regions').toPromise(); + return new Promise(resolve => { + resolve(MOCK_REGIONS); + }); } - public toMinMaxArray(min: number, max: number): number[] { - return [min, max]; + public getRegion(id: number): Promise { + return this.http.get(`${this.API_URL}/regions/${id}`).toPromise(); } } diff --git a/frontend/src/app/services/preset.service.spec.ts b/frontend/src/app/services/preset.service.spec.ts new file mode 100644 index 0000000..1ff75f8 --- /dev/null +++ b/frontend/src/app/services/preset.service.spec.ts @@ -0,0 +1,12 @@ +import {TestBed} from '@angular/core/testing'; + +import {PresetService} from './preset.service'; + +describe('PresetService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: PresetService = TestBed.get(PresetService); + expect(service).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/services/preset.service.ts b/frontend/src/app/services/preset.service.ts new file mode 100644 index 0000000..9e07a41 --- /dev/null +++ b/frontend/src/app/services/preset.service.ts @@ -0,0 +1,37 @@ +import {Injectable} from '@angular/core'; +import {DataService} from './data.service'; +import {Preset} from '../interfaces/preset.interface'; + +@Injectable({ + providedIn: 'root' +}) +export class PresetService { + + presets: Preset[]; + multiPresets: Map = new Map(); + singlePresets: Preset[] = []; + + constructor(private ds: DataService) { + } + + async initialize() { + this.presets = await this.ds.getAllPresets(); + const presetMap = new Map(); + + for (const preset of this.presets) { + if (presetMap.has(preset.parameter)) { + presetMap.get(preset.parameter).push(preset); + } else { + presetMap.set(preset.parameter, [preset]); + } + } + + for (const key of presetMap.keys()) { + if (presetMap.get(key).length > 1) { + this.multiPresets.set(key, presetMap.get(key)); + } else { + this.singlePresets.push(presetMap.get(key)[0]); + } + } + } +} diff --git a/frontend/src/assets/i18n/en.json b/frontend/src/assets/i18n/en.json index dbab354..32dbc4a 100644 --- a/frontend/src/assets/i18n/en.json +++ b/frontend/src/assets/i18n/en.json @@ -1,10 +1,26 @@ { - "temperature_mean": "Temperature Average", + "temperature_mean_max": "Temperature Average", "temperature": "Temperature", - "raindays": "Rainy days", - "sunhours": "Sunny hours", + "rain_days": "Rainy days", + "sun_hours": "Sunny hours", "precipitation": "Precipitation", "humidity": "Humidity", - "alcohol": "Alcohol coasts per day", - "food": "Food costs per day" + "alcohol_costs": "Alcohol coasts per day", + "food_costs": "Food costs per day", + "cheap_alcohol": "Cheap alcohol", + "cheap_food": "Cheap food", + "cheap_water": "Cheap water", + "cheap_transportations": "Cheap pubic transport", + "cheap_entertainment": "Cheap entertainment", + "warm": "warm", + "chilly": "chilly", + "mild:": "mild", + "cold": "cold", + "sunny": "sunny", + "dark": "dark", + "almost_no_rain": "almost none", + "little_rain": "little", + "floodlike_rain": "flooding", + "few_raindays": "few", + "many_raindays": "many" }