Skip to content

Commit

Permalink
Follow up fix for calculating credit points and average
Browse files Browse the repository at this point in the history
  • Loading branch information
jonastheis committed May 3, 2016
1 parent 792c194 commit 19c9cbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
> [MyGrades](https://mygrades.de/) Android App
[![Apache2 License](https://img.shields.io/badge/license-APACHE2-blue.svg?style=flat-square)](/LICENSE)
[![MyGrades Version](https://img.shields.io/badge/mygrades-1.0.7-8BC34A.svg?style=flat-square)](https://mygrades.de)
[![MyGrades Version](https://img.shields.io/badge/mygrades-1.0.8-8BC34A.svg?style=flat-square)](https://mygrades.de)
<br><br><br>
MyGrades is an Android App developed by [Tilman Ginzel](https://github.com/tilmanginzel) and [Jonas Theis](https://github.com/jonastheis). Its main purpose is to scrape a students grades from her/his respective university's website. To do so, it simulates a browser which follows a sequence of URLs and extracts the desired information with XPATH (web scraping). The core functionality is based on our Android App [Scrapp](https://github.com/tilmanginzel/scrapp), which we developed during our studies at the RheinMain University of Applied Sciences. Special thanks to [Rahel Habacker](https://github.com/RedHilarious)!

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId 'de.mygrades'
minSdkVersion 16
targetSdkVersion 23
versionCode 13
versionName "1.0.7"
versionCode 14
versionName "1.0.8"
}
buildTypes {
release {
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/de/mygrades/util/AverageCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ public void calculate(List<? extends GradesAdapterItem> items) {

GradeItem gradeItem = (GradeItem) item;
float actCreditPoints = (gradeItem.getCreditPoints() == null ? 0f : gradeItem.getCreditPoints());
if (gradeItem.getGrade() != null && gradeItem.getGrade() > 0 && gradeItem.getGrade() < 5) {
if (gradeItem.getGrade() != null && gradeItem.getGrade() >= 0 && gradeItem.getGrade() < 5) {
creditPointsSum += actCreditPoints;
creditPointsSumForAverage += actCreditPoints;
// only add grades with actual grade to the sum of credit points for average calculation
if (gradeItem.getGrade() > 0) {
creditPointsSumForAverage += actCreditPoints;
}
}

float grade = (gradeItem.getGrade() == null ? 0f : gradeItem.getGrade());
Expand Down

0 comments on commit 19c9cbf

Please sign in to comment.