issue#7-multipleTemperatureMockSensors #222

Closed
c24danli wants to merge 0 commits from issue#7-multipleTemperatureMockSensors into team_2_week_1
Collaborator

/tempSensorMockup

  • added multiple sensors as an arrya insted of one singular as before (creates sensors and mockdata)
    /tempSensorMockup
  • readTempSensorMockup
  • chaged to read an list of sensors insted of one object (reads sensors and adds to db)
    /tempService
  • changed to be able to handle a parameter to get the specific sensor when querring the db(The Api/querry from db to get the data)
    /frontend/src/features/temperature
  • added the view TemperatureTimeSeriesView and hook useTemperatureTimeSeriesView to show historic data with parameter for specifc sensor
  • changed TemperatureView and useTemperatureView to handle a parameter in the querry

Parprograming with a22erigr

/tempSensorMockup - added multiple sensors as an arrya insted of one singular as before (creates sensors and mockdata) /tempSensorMockup - readTempSensorMockup - chaged to read an list of sensors insted of one object (reads sensors and adds to db) /tempService - changed to be able to handle a parameter to get the specific sensor when querring the db(The Api/querry from db to get the data) /frontend/src/features/temperature - added the view TemperatureTimeSeriesView and hook useTemperatureTimeSeriesView to show historic data with parameter for specifc sensor - changed TemperatureView and useTemperatureView to handle a parameter in the querry Parprograming with a22erigr
/TempSensorMockup
var data= new{sensor1} chaged to var data= new[]{sensor1,sensor2..}
It used to give back a object with data of a single sensor now it returns an array with data from multiple sensors
/readTempSensorMockup
the read function used to expect an single object from tempSensorMockup but as its an array now its been changed to expect an array and a foreach loop have been intruduced to read and store the data from all sensors in the array
/tempService
i have included the sensorId in the class TempratureData, even if we stored sensorId,timestamp and temperature in the db we could only use the last two before in the View's/app it doesnt do anything now but its added to be able to make out witch sensor gives the reading.
we can save data from diffrent sensors and get it, but we have to be able to sort the data from diffrent sensors witch is the next problem.
Parprograming with: a22erigr
The api for both single and and entire history works when not using params to choose sensor
Latest- works with params as well to get from a specific sensor
all- doesnt work when choosing a specific sensor with params, it gets the param as unnown when we try to send it along

par programing with a22erigr
The Issue#7 and #12 is implimented in this branch, we can now create as manny mock sensors as we like, save the data to the db and querry it for either the latest temp or historic temp for each sensor seperatly.
If the historic data is going to be used it still needs to be filtered/sliced to get the intervalls and amount of data points wanted
c24elipe removed their assignment 2026-04-10 09:44:54 +00:00
Collaborator

Overall, everything seems fine and working, there are only a few comment issues that were addressed directly to the developer but shouldn't cause an issue.
And in the useTempreatureTimeSeriesView.js the useEffect should probably return sensorId as a dependency to ensure that switching between sensors refetches the hook, if i understood it correctly this is a problem. that should be fixed

so change from

useEffect(() => {
    fetch(API_URL + sensorId)
      .then(res => {
        if (!res.ok) throw new Error(`HTTP ${res.status}`);
        return res.json();
      })
      .then(json => {
        setData(json);
        setError(null);
      })
      .catch(err => setError(err.message))
      .finally(() => setLoading(false));
  }, []);

to:

useEffect(() => {
    fetch(API_URL + sensorId)
      .then(res => {
        if (!res.ok) throw new Error(`HTTP ${res.status}`);
        return res.json();
      })
      .then(json => {
        setData(json);
        setError(null);
      })
      .catch(err => setError(err.message))
      .finally(() => setLoading(false));
  }, [sensorId]); // this line !! ----------------------
Overall, everything seems fine and working, there are only a few comment issues that were addressed directly to the developer but shouldn't cause an issue. And in the useTempreatureTimeSeriesView.js the useEffect should probably return _sensorId_ as a dependency to ensure that switching between sensors refetches the hook, if i understood it correctly this is a problem. that should be fixed so change from ``` useEffect(() => { fetch(API_URL + sensorId) .then(res => { if (!res.ok) throw new Error(`HTTP ${res.status}`); return res.json(); }) .then(json => { setData(json); setError(null); }) .catch(err => setError(err.message)) .finally(() => setLoading(false)); }, []); ``` to: ``` useEffect(() => { fetch(API_URL + sensorId) .then(res => { if (!res.ok) throw new Error(`HTTP ${res.status}`); return res.json(); }) .then(json => { setData(json); setError(null); }) .catch(err => setError(err.message)) .finally(() => setLoading(false)); }, [sensorId]); // this line !! ---------------------- ```
Collaborator

Parprograming the feature with c24danli. The commit and pull were made from his computer.

Parprograming the feature with c24danli. The commit and pull were made from his computer.
+ Dependency for api
+ change indentation to follow standard
+ Removed out commented code
+ Added comments to explain the code
+ Incerted found no result logic
Collaborator

Some features that weren't in this branch were accidentally added and broke the code. It is now removed... Sorry 'bout that

Some features that weren't in this branch were accidentally added and broke the code. It is now removed... Sorry 'bout that
Collaborator

This was manually merged by me after finding that the broken code was created by my browser and wasn't a fault with the code.

Merged!

This was manually merged by me after finding that the broken code was created by my browser and wasn't a fault with the code. Merged!
c24elipe closed this pull request 2026-04-13 08:28:38 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!222
No description provided.