Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix ambiguity at next class and latest class list #17

Merged
merged 1 commit into from
Dec 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Fix ambiguity at next class and latest class list
  • Loading branch information
developerchan1 committed Dec 9, 2020
commit c01763fd219be84772d2059ef63a87465e1ede8e
2 changes: 1 addition & 1 deletion app/src/main/java/com/ambinusian/adab/room/ClassDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface ClassDAO {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertClass(ClassEntity entity);

@Query("SELECT * FROM classentity")
@Query("SELECT * FROM classentity ORDER BY datetime(sessionStartDate) ASC")
LiveData<List<ClassEntity>> getAllClass();

@Query("DELETE FROM classentity")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void onClick(View view) {
latestClassLayout.setVisibility(View.GONE);
}
else {
for (int i = nextClass - 1; i >= 0; i--) {
for (int i = nextClass - 1; i >= 0 && i >= nextClass-10; i--) {
ClassEntity classEntity = classEntities.get(i);
coursesList.add(new CourseModel(classEntity.getSessionId(),
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ public void onClick(View view) {
}
else {
latestClassLayout.setVisibility(View.VISIBLE);
for (int i = nextClass - 1; i >= 0; i--) {
//add maximal 10 latest class to the coursesList
for (int i = nextClass - 1; i >= 0 && i >= nextClass-10; i--) {
ClassEntity classEntity = classEntities.get(i);
coursesList.add(new CourseModel(classEntity.getSessionId(),
1,
Expand Down
4 changes: 2 additions & 2 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Wed Dec 09 01:47:55 ICT 2020
#Wed Dec 09 15:22:20 ICT 2020
VERSION_NAME=1.0.1
VERSION_CODE=478
VERSION_CODE=489