Skip to content

Commit

Permalink
Merge pull request #44 from ObjectiveTruth/fix_issue_with_calendar_no…
Browse files Browse the repository at this point in the history
…t_loading

Fix issue with calendar not loading
closes #43 #44
  • Loading branch information
ObjectiveTruth authored Nov 28, 2016
2 parents b91d033 + 1341fde commit 434d987
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {
}
dependencies {
// Main Android gradle plugin allows building of the entire play toolchain
classpath 'com.android.tools.build:gradle:2.2.0-beta3'
classpath 'com.android.tools.build:gradle:2.2.2'
// Fabric repository for Crashlytics.
classpath 'io.fabric.tools:gradle:1.+'
// Adds tasks to auto publish apks to Google App Store. https://github.com/Triple-T/gradle-play-publisher
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/assets/whatsnew_minor.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
September 2, 2016
===
‣ Booking from the calendar works
‣ Joining from the calendar works
‣ Leaving from the calendar works
‣ If you're not logged in, it will ask you to

August 14, 2016
===
‣ Scrolling downwards on the grid no longer randomly triggers pull to refresh
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/assets/whatsnew_thisversion.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
September 2, 2016
October 22, 2016
===
‣ Booking from the calendar works
‣ Joining from the calendar works
‣ Leaving from the calendar works
‣ If you're not logged in, it will ask you to
‣ Fixed issue with date not being available which crashed the app
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ static private ArrayList<MyAccountBooking> _getBookingsList(MyAccountBookingType
ArrayList<MyAccountBooking> returnArrayList = new ArrayList<MyAccountBooking>();

// Start at 2 because 0 is the empty string and 1 is the headers in the table
// also -1 on the length because the last row is a </tr> which isn't a full row
// Example: "<tr".split("<tr") => {"", "<tr"}
// Example:
// Header Row: // <tr><td>Room</td><td>Date</td><td>From</td><td>To</td></tr>
for(int i = 2; i < trStore.length; i++) {
for(int i = 2; i < trStore.length - 1; i++) {
MyAccountBooking returnMyAccountBooking = new MyAccountBooking();
String[] tdElements = trStore[2].split("<td");

Expand All @@ -112,8 +113,6 @@ static private ArrayList<MyAccountBooking> _getBookingsList(MyAccountBookingType
findStringFromStringBetweenSearchTerms(tdElements[2], ">", "</td");
returnMyAccountBooking.startTime =
findStringFromStringBetweenSearchTerms(tdElements[3], ">", "</td");
returnMyAccountBooking.endTime =
findStringFromStringBetweenSearchTerms(tdElements[4], ">", "</td");

returnArrayList.add(returnMyAccountBooking);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ private String _getDayOfWeekFromCalendarDataAtPosition(CalendarData calendarData
} catch (ParseException e) {
Timber.e(e, "Couldn't parse the string for the date. Got: " + parseMe);
return "";
} catch (ArrayIndexOutOfBoundsException e) {
Timber.w(e, "Day of week was not in the expected range");
return "";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public View getView(int row, int column, View recycleView, ViewGroup parent) {
bookingInteractionModel, calendarDay)); break;

case BOOKING_LOCKED:
TimeCell parentTimeCell = _getTimeCellWithGroupNameAboutThisOne(row, column);
TimeCell parentTimeCell = _getTimeCellWithGroupNameAboveThisOne(row, column);
if(parentTimeCell == null) {
parentTimeCell = new TimeCell(); parentTimeCell.groupNameForWhenFullyBookedRoom = "";}
holder.textViewOnly.setText(parentTimeCell.groupNameForWhenFullyBookedRoom);
Expand Down Expand Up @@ -187,7 +187,7 @@ private int _convertRowAndColumnToTimeCellIndex(int row, int column) {
* @return if null, it means it wasn't found
*/
@Nullable
private TimeCell _getTimeCellWithGroupNameAboutThisOne(int row, int column) {
private TimeCell _getTimeCellWithGroupNameAboveThisOne(int row, int column) {
for(int irow = row; irow > 0; irow--) {
TimeCell suspect = calendarDay.timeCells.get(_convertRowAndColumnToTimeCellIndex(irow, column));
if(suspect.timeCellType == BOOKING_CONFIRMED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.widget.TextView;
import com.objectivetruth.uoitlibrarybooking.R;
import com.objectivetruth.uoitlibrarybooking.data.models.usermodel.MyAccountBooking;
import timber.log.Timber;

import java.util.ArrayList;

Expand Down Expand Up @@ -47,7 +48,12 @@ public View getView(int position, View convertView, ViewGroup parent) {
viewHolder.textView.setText(myAccountBooking.date);
break;
case 2:
String startAndEndTime = myAccountBooking.startTime + "-" + myAccountBooking.endTime;
String startAndEndTime = myAccountBooking.startTime;
if(startAndEndTime == null) {
startAndEndTime = "<not found>";
Timber.w(new Throwable(new NullPointerException()),
"Starttime was null, which is never expected");
}
viewHolder.textView.setText(startAndEndTime);
break;
default:
Expand Down

0 comments on commit 434d987

Please sign in to comment.