Skip to content

Commit

Permalink
Fixed an issue with the parse no loading the date properly
Browse files Browse the repository at this point in the history
Also, the MyAccount Fragment wasn't working properly
  • Loading branch information
ObjectiveTruth committed Nov 28, 2016
1 parent 75ac2c6 commit 1341fde
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
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 @@ -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 1341fde

Please sign in to comment.