blumilksoftware / interns-2022c-internships

Intership programme application made by interns themselves.
MIT License
5 stars 5 forks source link

#36 - unique filtering content collector #66

Closed plencka closed 3 years ago

plencka commented 3 years ago

It should close #36.

Now data used in search filters is represented by ids inside Company data. Ids correspond to an index of array located in separate filters.json file.

Intention of this change is creating a list of available filters for user to choose.

plencka commented 3 years ago

This is an example of how saved data looks like:

Company data, with fields city, country and FilterData utilizing new feature:

{
        "id": 0,
        "name": "Blumilk sp. z o.o.",
        "address": {
            "coordinates": {
                "latitude": 51.208726,
                "longitude": 16.16372
            },
            "countryID": 0,
            "cityID": 0,
            "street": "Najświętszej Marii Panny 5F/5",
            "zip": "59-220"
        },
        "filterData": {
            "specialization": 0,
            "tags": [
                0,
                1,
                2,
                3,
                4
            ]
        },
        [...]
}

Resulting filters.json:

{
    "country": [
        {
            "id": 0,
            "name": "Polska"
        }
    ],
    "city": [
        {
            "id": 0,
            "name": "Legnica"
        },
        {
            "id": 1,
            "name": "Bogatynia"
        },
       [...]
    ],
    "specialization": [
        {
            "id": 0,
            "name": "Informatyka"
        }
    ],
    "tags": [
        {
            "id": 0,
            "name": "programowanie"
        },
        {
            "id": 1,
            "name": "web"
        },
        [...]
}
plencka commented 3 years ago

There are concerns regarding performance impact of loading real names from filters.json array using ids [which correspond to index in an array]. It might be an issue with MapBox refreshing tiles and pins every time user moves the map view.

I think the data could be cached the first time user loads the web page with correct language embeded into new .json. It would regenerate if data set changes or user selects different language [or simply store each localized name in an array with keys to avoid processing?]. This way, server-side data would be lightweight and will 'unpack' on the user's side.

Ids would still be used in searching, but names displayed would be directly taken from loaded Company object.

It's something to consider in new issue, if performance will be not good enough.