Skip to content
Snippets Groups Projects
Commit ab8794c4 authored by Christoph Thelen's avatar Christoph Thelen
Browse files

Cap learning progress at 100 percent

parent caae69e0
No related merge requests found
...@@ -1491,7 +1491,7 @@ public class CouchDBDao implements IDatabaseDao { ...@@ -1491,7 +1491,7 @@ public class CouchDBDao implements IDatabaseDao {
} }
final double courseAverageValue = userTotalValue / numUsers; final double courseAverageValue = userTotalValue / numUsers;
final double courseProgress = courseAverageValue / courseMaximumValue; final double courseProgress = courseAverageValue / courseMaximumValue;
return (int)Math.round(courseProgress * 100); return (int)Math.min(100, Math.round(courseProgress * 100));
} }
@Override @Override
...@@ -1517,8 +1517,9 @@ public class CouchDBDao implements IDatabaseDao { ...@@ -1517,8 +1517,9 @@ public class CouchDBDao implements IDatabaseDao {
return new AbstractMap.SimpleEntry<Integer, Integer>(0, courseProgress); return new AbstractMap.SimpleEntry<Integer, Integer>(0, courseProgress);
} }
final double myProgress = userTotalValue / courseMaximumValue; final double myProgress = userTotalValue / courseMaximumValue;
final int myLearningProgress = (int)Math.min(100, Math.round(myProgress*100));
return new AbstractMap.SimpleEntry<Integer, Integer>((int)Math.round(myProgress*100), courseProgress); return new AbstractMap.SimpleEntry<Integer, Integer>(myLearningProgress, courseProgress);
} }
@Override @Override
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment