#484-weekly-aggregated-temperature #580

Merged
b24johka merged 13 commits from #484-weekly-aggregated-temperature into team_1_week_3 2026-04-28 07:26:56 +00:00
Collaborator
  • /year and /year/month show proper values instead of giving errors.

  • /year/week implemented.

  • Maximum and minimum temperature implemented

  • sensorID used by aggregated data endpoints

  • sharedFeatures.js now used in aggregated data views correctly

This issue was mainly about implementing /year/week but I decided to update the old endpoints as well as I would be forced to do it for the /year/week anyways.
I mostly copied what was already written under /temperature/latest/{sensorId} in service\tempService\Program.cs and TemperatureView.js in *frontend\src\features\temperature\default*

I decided to add minimum and maximum temperatures as it was very simple to do and I think it's a nice change.

I also had to hardcode some values in Dashboard.js in the addNewView() function. I would suggest making a new issue to remove these hardcoded values and let the user change manually.
I remember @a24julot fixed this once.

Connected issues: #484 #20

- **/year** and **/year/month** show proper values instead of giving errors. - **/year/week** implemented. - **Maximum** and **minimum** temperature implemented - **sensorID** used by aggregated data endpoints - **sharedFeatures.js** now used in aggregated data views correctly This issue was mainly about implementing **/year/week** but I decided to update the old endpoints as well as I would be forced to do it for the **/year/week** anyways. I mostly copied what was already written under **/temperature/latest/{sensorId}** in **service\tempService\Program.cs** and **TemperatureView.js** in **frontend\src\features\temperature\default\** I decided to add minimum and maximum temperatures as it was very simple to do and I think it's a nice change. I also had to hardcode some values in **Dashboard.js** in the **addNewView()** function. I would suggest making a new issue to remove these hardcoded values and let the user change manually. I remember @a24julot fixed this once. Connected issues: #484 #20
48 KiB
65 KiB
week endpoint to get average temp from specific week
Added so HTTP 404 returns null instead so cards can still be shown
Updated to new structure and made it so average is calculated directly from SQL
Sharedfeatures is now used across the views together with the new sensor id variable.

/year and /month/year now works again
Views for /year/week now functioning
Made sure that NO DATA card is shown when there's no data instead of HTTP error.
/week now also fetch min and max temperature from the database
All aggregated endpoints now show min, max, and average tempeartures.
properly show max and min
Better output for when there's no data
Collaborator

Review on #484

Whats done

  • Checked to see how files are changes.
  • Checked that data is fetched when adding a widget to the dashboard.

Tested on Windows using Chrome

  • TemperatureYearView displays data.
  • TemperatureMonthView displays data.
  • TemperatureWeekView displays data

Inspected following files

  • frontend/src/components/Dashboard/Dashboard.js
  • frontend/src/features/temperature/default/useTemperature.js
  • frontend/src/features/temperature/month/TemperatureMonthView.js
  • frontend/src/features/temperature/month/useTemperatureByMonth.js
  • frontend/src/features/temperature/week/TemperatureWeekView.js
  • frontend/src/features/temperature/week/useTemperatureByWeek.js
  • frontend/src/features/temperature/year/TemperatureYearView.js
  • frontend/src/features/temperature/year/useTemperatureByYear.js
  • service/tempService/Program.cs
    • The code in Program.cs does not follow the correct formatting. Check the wiki page Formatter to install the correct formatter and use it on Program.cs.
      • Naming convention
        • Followed.
      • Comments
        • Follows standard. Although, in some places, there is not a capital letter and I found some misspelling. Example in pictures.
      • General code quality
        • Very good.

What needs to be done

  • Code needs to be correctly formatted.
  • Correct some comments and use capital letter in the beginning.

Conclusion

  • When the code is formatted it should pass the pull request and be merged, good job!
# Review on https://git.webug.se/Andras/BoundlessFlowCampus2K/issues/484 ## Whats done - Checked to see how files are changes. - Checked that data is fetched when adding a widget to the dashboard. ### Tested on Windows using Chrome - TemperatureYearView displays data. - TemperatureMonthView displays data. - TemperatureWeekView displays data ### Inspected following files - frontend/src/components/Dashboard/Dashboard.js - frontend/src/features/temperature/default/useTemperature.js - frontend/src/features/temperature/month/TemperatureMonthView.js - frontend/src/features/temperature/month/useTemperatureByMonth.js - frontend/src/features/temperature/week/TemperatureWeekView.js - frontend/src/features/temperature/week/useTemperatureByWeek.js - frontend/src/features/temperature/year/TemperatureYearView.js - frontend/src/features/temperature/year/useTemperatureByYear.js - service/tempService/Program.cs - The code in Program.cs does not follow the correct formatting. Check the wiki page [Formatter](https://git.webug.se/Andras/BoundlessFlowCampus2K/wiki/Formatter) to install the correct formatter and use it on Program.cs. - Naming convention - Followed. - Comments - Follows standard. Although, in some places, there is not a capital letter and I found some misspelling. Example in pictures. - General code quality - Very good. ## What needs to be done - Code needs to be correctly formatted. - Correct some comments and use capital letter in the beginning. ## Conclusion - When the code is formatted it should pass the pull request and be merged, good job!
a24julot left a comment
Collaborator

Code needs to be correctly formatted.
Correct some comments and use capital letter in the beginning.

Code needs to be correctly formatted. Correct some comments and use capital letter in the beginning.
Collaborator

Good job, the changes I requested are fixed, can be merged!

Good job, the changes I requested are fixed, can be merged!
Collaborator

The review has been really good and this will be merged right away.

The review has been really good and this will be merged right away.
b24johka merged commit 402b1bd217 into team_1_week_3 2026-04-28 07:26:56 +00:00
Collaborator

From the team 1 week branch the average temperatures are not loading again. It might be something to do with other features or restructuring that affect how it fetches data. The JSON URLs still work (example http://localhost/app/api/temperature/year/2026/month/4/temp-sensor-001). But the Views don't work.

From the team 1 week branch the average temperatures are not loading again. It might be something to do with other features or restructuring that affect how it fetches data. The JSON URLs still work (example http://localhost/app/api/temperature/year/2026/month/4/temp-sensor-001). But the Views don't work.
Author
Collaborator

@a24timsv yeah I noticed that the addnewview function has been moved from dashboard.js into its own file under card directory. So the hardcoded values I implemented got removed.

@a24timsv yeah I noticed that the **addnewview** function has been moved from **dashboard.js** into its own file under card directory. So the hardcoded values I implemented got removed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
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!580
No description provided.