Skip to content

first pass at fixing - #124

Merged
civsiv merged 10 commits into
masterfrom
coverage/missing-access-after-P
Apr 30, 2021
Merged

civsiv merged 10 commits into
masterfrom
coverage/missing-access-after-P

Conversation

@civsiv

@civsiv civsiv commented Apr 27, 2021 •

Copy link
Copy Markdown
Contributor

Waiting on #131 to merge as it will fix the CI issues with this PR

// Response OrderItems must be updated into supplied orderItemContexts (including duplicates for multi-party booking)

using (var db = FakeBookingSystem.Database.Mem.Database.Open())
var query = orderItemContexts.Select((orderItemContext) =>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been refactor to call a function on FakeDatabase instead of manipulating the tables from here

}
},
Activity = new List<Concept>
var getOccurrenceInfoResult = FakeBookingSystem.Database.GetOccurrenceAndBookedOrderItemInfoIfRelevantBySlotId(flowContext.OrderId.uuid, orderItemContext.RequestBookableOpportunityOfferId.SlotId);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call has the database logic

},
Activity = new List<Concept>
var getOccurrenceInfoResult = FakeBookingSystem.Database.GetOccurrenceAndBookedOrderItemInfoIfRelevantBySlotId(flowContext.OrderId.uuid, orderItemContext.RequestBookableOpportunityOfferId.SlotId);
if (getOccurrenceInfoResult.Item1 == FakeDatabaseGetOccurrenceAndBookedOrderItemInfoResult.OccurrenceWasNotFound)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destructure this, don't use Item1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

EndDate = (DateTimeOffset)slot.End,
MaximumUses = slot.MaximumUses,
// Exclude current Order from the returned lease count
RemainingUses = slot.RemainingUses - db.Count<OrderItemsTable>(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this into another db call that returns number of remaining uses minus leases

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


private static void AddPropertiesToBookedOrderItem(OrderItemContext<FacilityOpportunity> ctx, BookedOrderItemInfo bookedOrderItemInfo, StoreBookingFlowContext flowContext)
{
ctx.SetOrderItemId(flowContext, bookedOrderItemInfo.OrderItemId);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this as it's already set

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
}

private static void AddPropertiesToBookedOrderItem(OrderItemContext<FacilityOpportunity> ctx, BookedOrderItemInfo bookedOrderItemInfo, StoreBookingFlowContext flowContext)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstract this out and make generic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done



return (
FakeDatabaseGetOccurrenceAndBookedOrderItemInfoResult.OccurrenceAndBookedOrderItemInfoSuccessfullyGot,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to be shorter

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
}

public (FakeDatabaseGetOccurrenceAndBookedOrderItemInfoResult, FacilityUseTable, SlotTable, BookedOrderItemInfo) GetOccurrenceAndBookedOrderItemInfoIfRelevantBySlotId(string uuid, long? slotId)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to Slot not Occurrence

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

ImageUrl = orderItem.ImageUrl,
BarCodeText = orderItem.BarCodeText,
MeetingId = orderItem.MeetingId,
MeetingPassword = orderItem.MeetingPassword,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meeting* fields do not exist for facilities

@civsiv
civsiv merged commit 2065b8a into master Apr 30, 2021
@civsiv
civsiv deleted the coverage/missing-access-after-P branch April 30, 2021 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant