Skip to content

Commit

Permalink
Figures total in global statistics in titlebar - #5
Browse files Browse the repository at this point in the history
  • Loading branch information
seiza committed May 31, 2012
1 parent 0454c46 commit 6b75454
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Legomni/MasterViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ - (void)viewWillAppear:(BOOL)animated {
[self.tableView reloadData];
[self.tableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle];

int total = [legomni series].count * FIGURES_PER_SERIES;
int count = [legomni differentFiguresCount];
int doubles = [legomni doubleCount];
self.title = [NSString stringWithFormat:@"%@ (%d + %d)", (NSLocalizedString(@"LEGO miniFigures", @"LEGO miniFigures")), count, doubles];
self.title = [NSString stringWithFormat:@"%@ (%d/%d + %d)", (NSLocalizedString(@"LEGO miniFigures", @"LEGO miniFigures")), count, total, doubles];
}

- (void)viewDidAppear:(BOOL)animated
Expand Down Expand Up @@ -114,7 +115,7 @@ -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteg
Serie* serie = [self serieForIndex:section];
int count = [serie differentFiguresCount];
int doublesCount = [serie doubleCount];
return [NSString stringWithFormat:@"%@ %d (%d/16 + %d)", (NSLocalizedString(@"Série", @"Série")), serie.index, count, doublesCount];
return [NSString stringWithFormat:@"%@ %d (%d/%d + %d)", (NSLocalizedString(@"Série", @"Série")), serie.index, count, FIGURES_PER_SERIES, doublesCount];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
Expand Down
2 changes: 2 additions & 0 deletions Legomni/Models/Serie.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import <Foundation/Foundation.h>

#define FIGURES_PER_SERIES 16

@interface Serie : NSObject

@property (nonatomic) int index;
Expand Down

0 comments on commit 6b75454

Please sign in to comment.