Skip to content

Instantly share code, notes, and snippets.

@madclouds
Last active January 2, 2019 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madclouds/47e6edc3666cf963b73bbdc5f5e8ecf4 to your computer and use it in GitHub Desktop.
Save madclouds/47e6edc3666cf963b73bbdc5f5e8ecf4 to your computer and use it in GitHub Desktop.
Blockout Schedule Conflicts

Household Blockout Schedule Conflicts

Goal

Use a new endpoint to get conflicting schedules based on a desired blockout

Existing

BlockoutDeclineExistingPlansPickerController

  • Takes an array of ScheduleIDs
  • Gets schedules from core data, and groups them by plan
  • Displays each group with buttons to decline/ignore
  • PCOScheduleGroup : NSObject lives in PCOCocoa
  • ScheduleGroup : PCOScheduleGroup lives in Services
  • ScheduleGroupDataProvider: Finds, groups, and sorts schedules based on predicate and planID.

Questions:

  • JSON Mapping with PCOManagedObject? (Core Data)
  • Manual JSON mapping to a NSObject? (in Memory)
  • Where should new object live? PCOCocoa or Services?
  • Do I need a data provider? I think no, because I'm building a static list/group based on API response.

Work needed to be done:

  • Stop calling + (void)getSchedulesForPerson:(PCOObjectID *)personID inDateRangeWithStart:(NSDate *)startDate endDate:(NSDate *)endDate completion:(void(^)(NSSet<NSManagedObjectID *> *_Nullable scheduleIDs, NSError *_Nullable))completion; in PCOAPIBlockoutsController

  • Add + (void)getScheduleConflictsForBlockout:(PCOBlockout *)blockout completion:(void(^)(NSArray <PCOBlockoutScheduleConflictGroup> * _Nullable conflictGroups, NSError * _Nullable error))completion to PCOAPIBlockoutsController

  • JSON Mapping of new objects

  • Update BlockoutEditViewControler to use new API endpoint and pass new conflict groups

  • Create a new type of object BlockoutScheduleConflict and BlockoutScheduleConflictGroup

  • Add PCOBlockoutScheduleConflict object to PCOCocoa or Services?

  • Update BlockoutDeclineExistingPlansPickerController to use NSArray <BlockoutScheduleConfclit \*>\* data instead of Schedule group

  • Update BlockoutConflictCell to use BlockoutScheduleConflictGroup instead of ScheduleGroup

  • Update BlockoutConflictCellDelegate to use BlockoutScheduleConflictGroup instead of ScheduleGroup

  • Add declineScheduleConflict:BlockoutScheduleConflict to PCOAPIScheduleController

Objects

PCOBlockoutScheduleConflict Object

  • dates
  • orgName
  • personAvatarURL
  • personName
  • personID
  • serviceTypeName
  • shortDates
  • status
  • teamName
  • teamPositionName

PCOBlockoutScheduleConflictGroup Object

  • displayDate
  • serviceTypeName
  • scheduleConflicts
  • height for card view
  • Array of BlockoutScheduleConflict objects
  • initWithBlockoutScheduleConflicts:(NSArray<BlockoutScheduleConflict *> *)scheduleConflicts NS_DESIGNATED_INITIALIZER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment