|
|
|
|
1
|
use vars qw(@day_names);
|
1
|
use vars qw(@day_names);
|
2
|
use JSON;
|
2
|
use JSON;
|
3
|
|
3
|
|
4
|
-my $pinni_title = "(TaY) Café Pinni";
|
|
|
5
|
-my $bio_title = "(TAYS) Bio";
|
|
|
6
|
-my $kliininen_title = "(TAYS) Arvo";
|
|
|
7
|
-my $kliininen_fusion_title = "(TAYS) Arvo Fusion Kitchen";
|
|
|
8
|
-my $zip_salaattibaari_title = "(TTY) Zip Salaattibaari";
|
|
|
9
|
# last two in order are $kitchen_info_id, $menu_type_id
|
4
|
# last two in order are $kitchen_info_id, $menu_type_id
|
10
|
my @restaurant_info = (
|
5
|
my @restaurant_info = (
|
11
|
[ "(TaY) Yliopiston Ravintola", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/yliopistonravintola.aspx", "M", "left", 13, 60 ],
|
6
|
[ "(TaY) Yliopiston Ravintola", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/yliopistonravintola.aspx", "M", "left", 13, 60 ],
|
12
|
- [ "(TaY) Yliopiston Ravintola / Rohee Xtra", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/yliopistonravintola/roheextra.aspx", "M", "left", 13, 74 ],
|
|
|
13
|
- [ "(TaY) Yliopiston Ravintola / VegeBar", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/yliopistonravintola/vegebar.aspx", "", "left", 13, 5 ],
|
|
|
14
|
- [ "(TaY) Fusion Kitchen", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/yliopistonravintola/fusionkitchen.aspx", "", "left", 13, 3 ],
|
|
|
|
|
7
|
+ [ "(TaY) Yliopiston Ravintola / VegeBar", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/yliopistonravintola.aspx", "", "left", 13, 5 ],
|
15
|
[ "(TaY) Café Campus", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/caf%C3%A9campus.aspx", "", "left", 130019, 23 ],
|
8
|
[ "(TaY) Café Campus", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/caf%C3%A9campus.aspx", "", "left", 130019, 23 ],
|
16
|
- [ $pinni_title, "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/caf%C3%A9lunchpinni.aspx", "M", "middle", 130016, 60 ],
|
|
|
17
|
- [ $bio_title, "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/taykaupinkampus/medicabio.aspx", "M", "left", 5, 60 ],
|
|
|
18
|
- [ $kliininen_title, "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/taykaupinkampus/medicaarvo.aspx", "M", "left", 50026, 60 ],
|
|
|
19
|
- [ $kliininen_fusion_title, "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/taykaupinkampus/medicaarvo/fusionkitchen.aspx", "M", "left", 50026, 3 ],
|
|
|
|
|
9
|
+ [ "(TaY) Café Pinni", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/tayp%C3%A4%C3%A4kampus/caf%C3%A9lunchpinni.aspx", "M", "middle", 130016, 60 ],
|
|
|
10
|
+ [ "(TAYS) Arvo", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/taykaupinkampus/arvo.aspx", "M", "left", 5, 60 ],
|
|
|
11
|
+ [ "(TAYS) Café Lea (Fusion Kitchen)", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/taykaupinkampus/cafélea.aspx", "M", "left", 50026, 3 ],
|
|
|
12
|
+ [ "(TAYS) Café Lea (My Salad)", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/taykaupinkampus/cafélea.aspx", "M", "left", 50026, 76 ],
|
20
|
[ "(TTY) Newton", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/ttykampus/newton.aspx", "", "left", 6, 60],
|
13
|
[ "(TTY) Newton", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/ttykampus/newton.aspx", "", "left", 6, 60],
|
21
|
[ "(TTY) Café Konehuone / Såås bar", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/ttykampus/caf%C3%A9konehuone/s%C3%A5%C3%A5sbar.aspx", "", "left", 60038, 77],
|
14
|
[ "(TTY) Café Konehuone / Såås bar", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/ttykampus/caf%C3%A9konehuone/s%C3%A5%C3%A5sbar.aspx", "", "left", 60038, 77],
|
22
|
[ "(TTY) Café Konehuone / Fusion Kitchen", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/ttykampus/caf%C3%A9konehuone/fusionkitchen.aspx", "", "middle", 60038, 3 ],
|
15
|
[ "(TTY) Café Konehuone / Fusion Kitchen", "http://www.juvenes.fi/fi-fi/ravintolatjakahvilat/opiskelijaravintolat/ttykampus/caf%C3%A9konehuone/fusionkitchen.aspx", "", "middle", 60038, 3 ],
|
|
|
|
|
43
|
$day_id = $day_id + 1;
|
36
|
$day_id = $day_id + 1;
|
44
|
}
|
37
|
}
|
45
|
|
38
|
|
46
|
-sub can_merge_bio_kliininen {
|
|
|
47
|
- my $day = shift;
|
|
|
48
|
-
|
|
|
49
|
- my $bio_foods = "";
|
|
|
50
|
- my $kliininen_foods = "";
|
|
|
51
|
- my $food_dest;
|
|
|
52
|
- foreach my $r (@restaurants) {
|
|
|
53
|
- my ($title, $open_hours, $week, $week_foods_ref) = @{$r};
|
|
|
54
|
- if ($title eq $bio_title) {
|
|
|
55
|
- $food_dest = \$bio_foods;
|
|
|
56
|
- } elsif ($title eq $kliininen_title) {
|
|
|
57
|
- $food_dest = \$kliininen_foods;
|
|
|
58
|
- } else {
|
|
|
59
|
- next;
|
|
|
60
|
- }
|
|
|
61
|
- my @week_foods = @{$week_foods_ref};
|
|
|
62
|
- foreach my $food (@{$week_foods[$day]}) {
|
|
|
63
|
- ${$food_dest} .= "$food\n";
|
|
|
64
|
- }
|
|
|
65
|
- }
|
|
|
66
|
- return $bio_foods eq $kliininen_foods;
|
|
|
67
|
-}
|
|
|
68
|
-
|
|
|
69
|
-sub try_merge_bio_kliininen {
|
|
|
70
|
- my ($title_ref, $day) = @_;
|
|
|
71
|
- my $title = $$title_ref;
|
|
|
72
|
-
|
|
|
73
|
- if ($title eq $bio_title && can_merge_bio_kliininen($day)) {
|
|
|
74
|
- $$title_ref .= " + Kliininen";
|
|
|
75
|
- } elsif ($title eq $kliininen_title && can_merge_bio_kliininen($day)) {
|
|
|
76
|
- return 1;
|
|
|
77
|
- }
|
|
|
78
|
- return 0;
|
|
|
79
|
-}
|
|
|
80
|
-
|
|
|
81
|
sub get_juvenes_restaurants {
|
39
|
sub get_juvenes_restaurants {
|
82
|
my $use_old = shift;
|
40
|
my $use_old = shift;
|
83
|
my $count = 0;
|
41
|
my $count = 0;
|