ppyordanov / Dynamic-Noise-and-Pollution-Map

A dynamically generated University of Glasgow noise and pollution campus map via the innovative Smart Citizen Kit developed in Barcelona, Spain by FabLab.
0 stars 0 forks source link

Client-server Data Transmission #63

Closed ppyordanov closed 9 years ago

ppyordanov commented 9 years ago

There is a bug when transmitting data between the client and the server. Sensor values are not updated and only the initial array value is transmitted.

ppyordanov commented 9 years ago

This issue has now been resolved. The "sample_data" JSON structure (represented as an associative array in JavaScript) needs to be re-initialized (reset) after each array data aggregation.

Re-assigning values of separate key-value mappings is more unsafe compared to the current approach:

function getSCKData(location, routeId)
{
    sample_data = {
        no2: "",
        co: "",
        noise: "",
        battery: "",
        latitude: "",
        longitude: "",
        routeId: ""
    };

...
}

Logged data:

request_logging