<commit_before>//
//  Canteen.swift
//  HTWDD
//
//  Created by <NAME> on 29.10.17.
//  Copyright © 2017 HTW Dresden. All rights reserved.
//

import Foundation
import CoreLocation
import RxSwift

struct Canteen {
    let name: String
    let id: Id
    let coordinate: CLLocationCoordinate2D?

    static let reichenbachstrasse = Canteen(name: "Mensa Reichenbachstraße",
                                            id: .reichenbachstrasse,
                                            coordinate: CLLocationCoordinate2D(latitude: 51.0342243,
                                                                               longitude: 13.7318803))
    
    static let siedepunkt = Canteen(name: "<NAME>",
                                    id: .siedepunkt,
                                    coordinate: CLLocationCoordinate2D(latitude: 51.0295216,
                                                                       longitude: 13.7375996))
    
    static let zeltschloesschen = Canteen(name: "<NAME>",
                                          id: .zeltschloesschen,
                                          coordinate: CLLocationCoordinate2D(latitude: 51.03155355,
                                                                             longitude: 13.7286415224337))
    
    static let alteMensa = Canteen(name: "<NAME>",
                                   id: .alteMensa,
                                   coordinate: CLLocationCoordinate2D(latitude: 51.0269420344792,
                                                                      longitude: 13.7264835834503))
    
    static let wuEins = Canteen(name: "<NAME>",
                                id: .wuEins,
                                coordinate: CLLocationCoordinate2D(latitude: 51.0298300687576,
                                                                   longitude: 13.7489497661591))
    
    static let bioMensaUboot = Canteen(name: "BioMensa U-Boot",
                                       id: .bioMensaUboot,
                                       coordinate: CLLocationCoordinate2D(latitude: 51.02992515,
                                                                          longitude: 13.7490836869859))
    
    static let mensaBruehl = Canteen(name: "<NAME>",
                                     id: .mensaBruehl,
                                     coordinate: CLLocationCoordinate2D(latitude: 51.0530039,
                                                                        longitude: 13.7419394))
    
    static let stimmGabel = Canteen(name: "<NAME>",
                                    id: .stimmGabel,
                                    coordinate: CLLocationCoordinate2D(latitude: 51.05359,
                                                                       longitude: 13.72512))
    
    static let johannStadt = Canteen(name: "<NAME>",
                                     id: .johannStadt,
                                     coordinate: CLLocationCoordinate2D(latitude: 51.0517855,
                                                                        longitude: 13.7596818))
    
    static let paluccaSchule = Canteen(name: "<NAME>",
                                       id: .paluccaSchule,
                                       coordinate: CLLocationCoordinate2D(latitude: 51.02907,
                                                                          longitude: 13.77088))
    
    static let sport = Canteen(name: "<NAME>",
                               id: .sport,
                               coordinate: CLLocationCoordinate2D(latitude: 51.06825,
                                                                  longitude: 13.719))
    
    static let mensologie = Canteen(name: "Mensologie",
                                    id: .mensologie,
                                    coordinate: CLLocationCoordinate2D(latitude: 51.052631120726,
                                                                       longitude: 13.7843227386475))
    
    static let kreuzGymnasium = Canteen(name: "<NAME>",
                                        id: .kreuzGymnasium,
                                        coordinate: CLLocationCoordinate2D(latitude: 51.0464933,
                                                                           longitude: 13.8016997))
    
    static let all = [reichenbachstrasse, siedepunkt, zeltschloesschen, alteMensa, wuEins, bioMensaUboot, mensaBruehl, stimmGabel, johannStadt, paluccaSchule, sport, mensologie, kreuzGymnasium]

    static func with(id: Id) throws -> Canteen {
        guard let canteen = all.first(where: { $0.id == id }) else {
            throw Canteen.Error.incompatibleCanteen(id: id)
        }
        return canteen
    }

    enum Id: String {
        case reichenbachstrasse = "mensa_reichenbachstraße"
        case siedepunkt = "mensa_siedepunkt"
        
        case zeltschloesschen
        case alteMensa
        case wuEins
        case bioMensaUboot
        case mensaBruehl
        case stimmGabel
        case johannStadt
        case paluccaSchule
        case sport
        case mensologie
        case kreuzGymnasium
        
        static let all: [Id] = [.reichenbachstrasse, .siedepunkt, .zeltschloesschen, .alteMensa, .wuEins, .bioMensaUboot, .mensaBruehl, .stimmGabel, .johannStadt, .paluccaSchule, .sport, .mensologie, .kreuzGymnasium]
    }
}

extension Canteen {
    enum Error: Swift.Error {
        case incompatibleCanteen(id: Canteen.Id)
    }

    func getMeals(network: Network) -> Observable<[Meal]> {
        return network.getArray(url: "http://lucas-vogel.de/mensa2/backend", params: ["mensaId": self.id.rawValue])
    }
}<commit_msg>add missing canteen ids<commit_after>//
//  Canteen.swift
//  HTWDD
//
//  Created by <NAME> on 29.10.17.
//  Copyright © 2017 HTW Dresden. All rights reserved.
//

import Foundation
import CoreLocation
import RxSwift

struct Canteen {
    let name: String
    let id: Id
    let coordinate: CLLocationCoordinate2D?

    static let reichenbachstrasse = Canteen(name: "<NAME>",
                                            id: .reichenbachstrasse,
                                            coordinate: CLLocationCoordinate2D(latitude: 51.0342243,
                                                                               longitude: 13.7318803))
    
    static let siedepunkt = Canteen(name: "<NAME>",
                                    id: .siedepunkt,
                                    coordinate: CLLocationCoordinate2D(latitude: 51.0295216,
                                                                       longitude: 13.7375996))
    
    static let zeltschloesschen = Canteen(name: "<NAME>",
                                          id: .zeltschloesschen,
                                          coordinate: CLLocationCoordinate2D(latitude: 51.03155355,
                                                                             longitude: 13.7286415224337))
    
    static let alteMensa = Canteen(name: "<NAME>",
                                   id: .alteMensa,
                                   coordinate: CLLocationCoordinate2D(latitude: 51.0269420344792,
                                                                      longitude: 13.7264835834503))
    
    static let wuEins = Canteen(name: "<NAME>",
                                id: .wuEins,
                                coordinate: CLLocationCoordinate2D(latitude: 51.0298300687576,
                                                                   longitude: 13.7489497661591))
    
    static let bioMensaUboot = Canteen(name: "BioMensa U-Boot",
                                       id: .bioMensaUboot,
                                       coordinate: CLLocationCoordinate2D(latitude: 51.02992515,
                                                                          longitude: 13.7490836869859))
    
    static let mensaBruehl = Canteen(name: "<NAME>",
                                     id: .mensaBruehl,
                                     coordinate: CLLocationCoordinate2D(latitude: 51.0530039,
                                                                        longitude: 13.7419394))
    
    static let stimmGabel = Canteen(name: "<NAME>",
                                    id: .stimmGabel,
                                    coordinate: CLLocationCoordinate2D(latitude: 51.05359,
                                                                       longitude: 13.72512))
    
    static let johannStadt = Canteen(name: "<NAME>",
                                     id: .johannStadt,
                                     coordinate: CLLocationCoordinate2D(latitude: 51.0517855,
                                                                        longitude: 13.7596818))
    
    static let paluccaSchule = Canteen(name: "<NAME>",
                                       id: .paluccaSchule,
                                       coordinate: CLLocationCoordinate2D(latitude: 51.02907,
                                                                          longitude: 13.77088))
    
    static let sport = Canteen(name: "<NAME>",
                               id: .sport,
                               coordinate: CLLocationCoordinate2D(latitude: 51.06825,
                                                                  longitude: 13.719))
    
    static let mensologie = Canteen(name: "Mensologie",
                                    id: .mensologie,
                                    coordinate: CLLocationCoordinate2D(latitude: 51.052631120726,
                                                                       longitude: 13.7843227386475))
    
    static let kreuzGymnasium = Canteen(name: "<NAME>",
                                        id: .kreuzGymnasium,
                                        coordinate: CLLocationCoordinate2D(latitude: 51.0464933,
                                                                           longitude: 13.8016997))
    
    static let all = [reichenbachstrasse, siedepunkt, zeltschloesschen, alteMensa, wuEins, bioMensaUboot, mensaBruehl, stimmGabel, johannStadt, paluccaSchule, sport, mensologie, kreuzGymnasium]

    static func with(id: Id) throws -> Canteen {
        guard let canteen = all.first(where: { $0.id == id }) else {
            throw Canteen.Error.incompatibleCanteen(id: id)
        }
        return canteen
    }

    enum Id: String {
        case reichenbachstrasse = "mensa_reichenbachstraße"
        case siedepunkt = "mensa_siedepunkt"
        case zeltschloesschen = "zeltschloesschen"
        case alteMensa = "alte_mensa"
        case wuEins = "mensa_wueins"
        case bioMensaUboot = "biomensa_u_boot"
        case mensaBruehl = "mensa_bruehl"
        case stimmGabel = "mensa_stimm_gabel"
        case johannStadt = "mensa_johannstadt"
        case paluccaSchule = "mensa_palucca_hochschule"
        case sport = "mensa_sport"
        case mensologie = "mensologie"
        case kreuzGymnasium = "mensa_kreuzgymnasium"
        
        static let all: [Id] = [.reichenbachstrasse, .siedepunkt, .zeltschloesschen, .alteMensa, .wuEins, .bioMensaUboot, .mensaBruehl, .stimmGabel, .johannStadt, .paluccaSchule, .sport, .mensologie, .kreuzGymnasium]
    }
}

extension Canteen {
    enum Error: Swift.Error {
        case incompatibleCanteen(id: Canteen.Id)
    }

    func getMeals(network: Network) -> Observable<[Meal]> {
        return network.getArray(url: "http://lucas-vogel.de/mensa2/backend", params: ["mensaId": self.id.rawValue])
    }
}
{'fraction_non_alphanumeric': 0.07405803378085751, 'fraction_numerical': 0.051104374187960155, 'mean_word_length': 1.1413204747774481, 'pattern_counts': {'":': 2, '<': 28, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 140, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '968287', 'n_tokens_mistral': 3396, 'n_tokens_neox': 2956, 'n_words': 595}