Skip to content

Commit

Permalink
Update MTBReportViewModel.m
Browse files Browse the repository at this point in the history
  • Loading branch information
apparition47 authored Jun 7, 2024
1 parent 14c63ab commit a405e1f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/MTBReportViewModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ - (void)getTrackersWithSuccess:(void (^)(NSArray<Tracker*> *reports, NSString *m
__weak typeof(self) weakSelf = self;
[managedObjectContext performBlock:^{
__strong typeof(self) strongSelf = weakSelf;
[strongSelf.managedObjectContext refreshAllObjects];
[weakSelf.managedObjectContext refreshAllObjects];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Tracker"
inManagedObjectContext:[self managedObjectContext]];
inManagedObjectContext:[strongSelf managedObjectContext]];
[fetchRequest setEntity:entity];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name"
ascending:YES];
Expand All @@ -50,7 +50,7 @@ - (void)getTrackersWithSuccess:(void (^)(NSArray<Tracker*> *reports, NSString *m


NSError *error = nil;
strongSelf.reports = [strongSelf.managedObjectContext executeFetchRequest:fetchRequest error:&error];
weakSelf.reports = [strongSelf.managedObjectContext executeFetchRequest:fetchRequest error:&error];

NSString *mostFreqTrackerName = @"";
NSUInteger maxTrackerCount = 0;
Expand All @@ -76,7 +76,7 @@ - (void)getTrackerRatioWithSuccess:(void (^)(NSString *percentage))successComple
__strong typeof(self) strongSelf = weakSelf;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Email"
inManagedObjectContext:[self managedObjectContext]];
inManagedObjectContext:[strongSelf managedObjectContext]];
[fetchRequest setEntity:entity];

NSError *error = nil;
Expand All @@ -99,9 +99,9 @@ - (void)getTrackerRatioWithSuccess:(void (^)(NSString *percentage))successComple

-(NSInteger)numberOfChildrenOfItem:(id)item {
if (!item) {
return _reports.count;
return _reports.count; // # of trackers
}
return ((Tracker *)item).reports.count;
return ((Tracker *)item).reports.count; // seen instances of a given tracker
}

-(id)modelAtChild:(NSInteger)index ofItem:(id)item {
Expand Down

0 comments on commit a405e1f

Please sign in to comment.