HTWK-App / Server-Application

Server-Application, designed for use with the HTWK Smartphone-App
GNU General Public License v3.0
1 stars 1 forks source link

API - Test: /app/mensa #27

Closed Zipunrar closed 10 years ago

Zipunrar commented 10 years ago

The provided List should be redesign to the following Layout:

{
  "location": {
    153 : "Cafeteria Dittrichring",
    121 : "Cafeteria Koburger Straße",
    127 : "Cafeteria Philipp-Rosenthal-Straße",
    129 : "Cafeteria Wächterstraße",
    118 : "Mensa Academica",
    111 : "Mensa Peterssteinweg",
    140 : "Mensa Schönauer Straße",
    170 : "Mensa Tierklinik",
    115 : "Mensa am Elsterbecken",
    106 : "Mensa am Park",
    162 : "Mensaria Liebigstraße"
  }
}
hknochi commented 10 years ago

why should the keys and values should been swaped? in case of a poor lookup the results are found better( when staying in implemented way)

Zipunrar commented 10 years ago

I thought the Key is the ID of the canteen and the Value the "clear" name. That would be the logical Order. Also the ID is better for Using as an Array Index then a String.

If poor Lookup would be a Problem (meaning ID could be double?), the Request to the Server would result in an not consistent Response?

Zipunrar commented 10 years ago

There is a Mistake in the MensaController:

if(!locations.containsKey(location)){
            throw new InvalidAttributeValueException("no valid location was chosen");
        }

That Test is wrong. As long as the Key-Value Pairs are not switched (like i suggest).