Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-v23-03
backend
Commits
9f5a017a
Commit
9f5a017a
authored
1 year ago
by
Pedro Pablo Cardona Arroyave
Browse files
Options
Downloads
Patches
Plain Diff
The endpoint to get the annuakky CO2 per person was fixed to be more frinedly with the new users
parent
901dffca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/ntnu/idatt2016/v233/SmartMat/util/StatisticUtil.java
+5
-1
5 additions, 1 deletion
...java/ntnu/idatt2016/v233/SmartMat/util/StatisticUtil.java
with
5 additions
and
1 deletion
src/main/java/ntnu/idatt2016/v233/SmartMat/util/StatisticUtil.java
+
5
−
1
View file @
9f5a017a
...
...
@@ -113,7 +113,11 @@ public class StatisticUtil {
long
diffInDays
=
diffInMillis
/
(
24
*
60
*
60
*
1000
);
double
co2Sum
=
0.0
;
for
(
double
c02
:
co2List
)
co2Sum
+=
c02
;
return
co2Sum
/
(((
double
)
(
diffInDays
+
1
)
/
365.0
)
*
(
double
)
numberOfPerson
);
if
(
diffInDays
>=
365
){
return
co2Sum
/
(((
double
)
(
diffInDays
+
1
)
/
365.0
)
*
(
double
)
numberOfPerson
);
}
else
{
return
(((
co2Sum
)/((
double
)
numberOfPerson
)
+
118.0
)
/
2.0
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment