mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
fixed selected month
This commit is contained in:
@@ -60,6 +60,7 @@ func (s *Data) StoreData() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//function to update the daily temperature max or min for a location
|
||||||
func (s *Data) UpdateData() error {
|
func (s *Data) UpdateData() error {
|
||||||
|
|
||||||
if db.Mongo.Connected() {
|
if db.Mongo.Connected() {
|
||||||
@@ -85,6 +86,8 @@ func (s *Data) UpdateData() error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get the current daily sensor reading to compare
|
||||||
|
//if the max or min temp needs to be updated
|
||||||
func GetDailySensorInfo(sensor_location string) (Data, error) {
|
func GetDailySensorInfo(sensor_location string) (Data, error) {
|
||||||
|
|
||||||
d := Data{}
|
d := Data{}
|
||||||
@@ -143,6 +146,8 @@ func GetAllSensorInfo(sensor_location string) ([]Data, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//return all daily temperature readings per year for a location
|
||||||
|
//sort by most recent year and oldest month
|
||||||
func GetAllSensorInfoByYear(sensor_location string, year int) ([]Data, error) {
|
func GetAllSensorInfoByYear(sensor_location string, year int) ([]Data, error) {
|
||||||
d := []Data{}
|
d := []Data{}
|
||||||
|
|
||||||
@@ -168,6 +173,7 @@ func GetAllSensorInfoByYear(sensor_location string, year int) ([]Data, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//return all temperature readings for a specific month and location
|
||||||
func GetAllSensorInfoByMonth(sensor_location string, year int, monthname string) ([]Data, error) {
|
func GetAllSensorInfoByMonth(sensor_location string, year int, monthname string) ([]Data, error) {
|
||||||
d := []Data{}
|
d := []Data{}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ app.controller('SensorInfoController', function($scope, $http, $routeParams) {
|
|||||||
|
|
||||||
if ($scope.list.length > 0) {
|
if ($scope.list.length > 0) {
|
||||||
$scope.selectedObject = $scope.list[0];
|
$scope.selectedObject = $scope.list[0];
|
||||||
$scope.selectedMonth = $scope.list[0].months[0];
|
$scope.selectedMonth = $scope.list[0].months[$scope.list.months.length];
|
||||||
|
|
||||||
$scope.loadingMonth = true;
|
$scope.loadingMonth = true;
|
||||||
$scope.loadingYear = true;
|
$scope.loadingYear = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user