<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -13,8 +13,6 @@
 @interface DBTagProvider : TagProvider
 {
    LocalCache *local_cache_;
-   NSArray *tags_;
-   BOOL dirty_;
 }
 @end
 </diff>
      <filename>model/DBTagProvider.h</filename>
    </modified>
    <modified>
      <diff>@@ -23,24 +23,18 @@
 {
    if (self = [super init]) {
       local_cache_ = [LocalCache sharedLocalCache];
-      dirty_ = NO;
    }
    return self;
 }
 
 - (void) dealloc
 {
-   if (tags_) [tags_ release];
    [super dealloc];
 }
 
 - (NSArray *) tags
 {
-   if (dirty_ || ! tags_) {
-      [self loadTags];
-      dirty_ = NO;
-   }
-   return tags_;
+   return [self loadTags];
 }
 
 - (void) updateTaskSeriesID:(RTMTag *)tag tid:(NSNumber *)tid 
@@ -86,7 +80,7 @@
    NSMutableArray *tags = [NSMutableArray array];
 
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-   NSArray *tag_keys = [NSArray arrayWithObject:@&quot;name&quot;];
+   NSArray *tag_keys = [NSArray arrayWithObject:@&quot;tag.name&quot;];
    NSArray *join_keys = [NSArray arrayWithObjects:@&quot;table&quot;, @&quot;condition&quot;, nil];
    NSArray *join_vals = [NSArray arrayWithObjects:@&quot;task_tag&quot;, @&quot;tag.id=task_tag.tag_id&quot;, nil];
    NSDictionary *join_dict = [NSDictionary dictionaryWithObjects:join_vals forKeys:join_keys];
@@ -96,8 +90,13 @@
    NSDictionary *tag_opts = [NSDictionary dictionaryWithObjects:tag_opt_vals forKeys:tag_opt_keys];
 
    NSArray *tags_dict = [local_cache_ select:tag_keys from:@&quot;tag&quot; option:tag_opts];
-   for (NSDictionary *tag in tags_dict)
-      [tags addObject:[tag objectForKey:@&quot;name&quot;]];
+   for (NSDictionary *tag_dict in tags_dict) {
+      RTMTag *tag = [[RTMTag alloc]
+                     initWithID:[tag_dict objectForKey:@&quot;tag.id&quot;]
+                     forName:[tag_dict objectForKey:@&quot;tag.name&quot;]];
+      [tags addObject:tag];
+      [tag release];
+   }
 
    [pool release];
    return tags;
@@ -112,23 +111,19 @@
    NSMutableArray *tags = [NSMutableArray array];
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-   NSArray *keys  = [NSArray arrayWithObjects:@&quot;id&quot;, @&quot;name&quot;, nil];
+   NSArray *keys  = [NSArray arrayWithObjects:@&quot;tag.id&quot;, @&quot;tag.name&quot;, nil];
    NSArray *tag_arr = option ?
       [local_cache_ select:keys from:@&quot;tag&quot; option:option] :
       [local_cache_ select:keys from:@&quot;tag&quot;];
 
    for (NSDictionary *dict in tag_arr) {
       RTMTag *tag = [[RTMTag alloc]
-         initWithID:[dict objectForKey:@&quot;id&quot;]
-         forName:[dict objectForKey:@&quot;name&quot;]];
+         initWithID:[dict objectForKey:@&quot;tag.id&quot;]
+         forName:[dict objectForKey:@&quot;tag.name&quot;]];
       [tags addObject:tag];
       [tag release];
    }
    [pool release];
-
-   if (tags_)
-      [tags_ release];
-   tags_ = [tags retain];
    return tags;
 }
 
@@ -141,7 +136,6 @@
 - (void) erase
 {
    [local_cache_ delete:@&quot;tag&quot; condition:nil];
-   dirty_ = YES;
 }
 
 - (void) remove:(RTMTag *) tag
@@ -149,7 +143,6 @@
    NSString *cond = [NSString stringWithFormat:@&quot;WHERE id = %@&quot;,
       [[tag iD] stringValue]];
    [local_cache_ delete:@&quot;tag&quot; condition:cond];
-   dirty_ = YES;
 }
 
 - (void) create:(NSDictionary *)params
@@ -176,8 +169,6 @@
    NSMutableDictionary *task_tag = [NSDictionary dictionaryWithObjects:vals forKeys:keys];
 
    [local_cache_ insert:task_tag into:@&quot;task_tag&quot;];
-
-   dirty_ = YES;
 }
 
 - (void) createRelation:(NSNumber *)task_id tag_id:(NSNumber *)tag_id
@@ -187,7 +178,6 @@
    NSDictionary *attrs = [NSDictionary dictionaryWithObjects:vals forKeys:keys];
 
    [local_cache_ insert:attrs into:@&quot;task_tag&quot;];
-   dirty_ = YES;
 }
 
 - (NSString *)nameForTagID:(NSNumber *)tag_id {</diff>
      <filename>model/DBTagProvider.m</filename>
    </modified>
    <modified>
      <diff>@@ -46,7 +46,6 @@
 
    for (NSDictionary *dict in task_arr) {
       RTMTask *task = [[RTMTask alloc] initByAttributes:dict];
-
       [tasks addObject:task];
       [task release];
    }
@@ -68,7 +67,7 @@
    NSString *where = [NSString stringWithFormat:@&quot;list_id=%d&quot;, list_id];
    if (! sc)
       where = [where stringByAppendingString:@&quot; AND completed IS NULL&quot;];
-   
+
    NSArray *keys = [NSArray arrayWithObjects:@&quot;WHERE&quot;, @&quot;ORDER&quot;, nil];
    NSArray *vals = [NSArray arrayWithObjects:where,
       [NSString stringWithFormat:@&quot;priority ASC, due IS NULL ASC, due ASC&quot;],
@@ -82,7 +81,7 @@
 {
    NSArray *join_keys = [NSArray arrayWithObjects:@&quot;table&quot;, @&quot;condition&quot;, nil];
    NSArray *join_vals = [NSArray arrayWithObjects:@&quot;task_tag&quot;, @&quot;task.id=task_tag.task_id&quot;, nil];
-   
+
    NSString *where = [NSString stringWithFormat:@&quot;task_tag.tag_id=%d&quot;, tag_id];
    if (! sc)
       where = [where stringByAppendingString:@&quot; AND completed IS NULL&quot;];
@@ -99,18 +98,6 @@
    return [self tasksWithCondition:cond];
 }
 
-- (NSArray *) completedTasks
-{
-   NSDictionary *cond = [NSDictionary dictionaryWithObject:@&quot;completed IS NOT NULL&quot; forKey:@&quot;WHERE&quot;];
-   return [self tasksWithCondition:cond];
-}
-
-- (NSArray *) yetTasks
-{
-   NSDictionary *cond = [NSDictionary dictionaryWithObject:@&quot;completed IS NOT NULL&quot; forKey:@&quot;WHERE&quot;];
-   return [self tasksWithCondition:cond];
-}
-
 /*
 - (NSArray *) modifiedTasks
 {</diff>
      <filename>model/DBTaskProvider.m</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@
 
 - (NSArray *) tasks
 {
-   return [[TaskProvider sharedTaskProvider] tasksInTag:[self.iD integerValue]];
+   return [[TaskProvider sharedTaskProvider] tasksInTag:[self.iD integerValue] showCompleted:YES];
 }
 
 - (id) copyWithZone:(NSZone *)zone</diff>
      <filename>model/RTMTag.m</filename>
    </modified>
    <modified>
      <diff>@@ -18,8 +18,6 @@
 - (NSArray *) tasksInList:(NSInteger) list_id showCompleted:(BOOL) sc;
 - (NSArray *) tasksInTag: (NSInteger) tag_id showCompleted:(BOOL) sc;
 
-- (NSArray *) completedTasks;
-
 //- (NSArray *) modifiedTasks;
 //- (NSArray *) pendingTasks;
 //- (NSArray *) existingTasks;</diff>
      <filename>model/TaskProvider.h</filename>
    </modified>
    <modified>
      <diff>@@ -148,11 +148,6 @@
 //   return nil;
 //}
 
-- (NSArray *) completedTasks
-{
-   NSAssert(NO, @&quot;not reach here&quot;);
-   return nil;
-}
 
 + (TaskProvider *) sharedTaskProvider
 {</diff>
      <filename>model/TaskProvider.m</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,7 @@
 #import &lt;SenTestingKit/SenTestingKit.h&gt;
 #import &quot;RTMAPI.h&quot;
 #import &quot;RTMTask.h&quot;
+#import &quot;RTMTag.h&quot;
 #import &quot;RTMNote.h&quot;
 #import &quot;TaskProvider.h&quot;
 #import &quot;MilponHelper.h&quot;
@@ -28,13 +29,13 @@
 
 - (void) testTasks
 {
-   NSArray *tasks = [tp tasks];
+   NSArray *tasks = [tp tasks:YES];
    STAssertEquals(tasks.count, 3U, @&quot;should have some task elements.&quot;);
 }
 
 - (void) testPriority
 {
-   NSArray *tasks = [tp tasks];
+   NSArray *tasks = [tp tasks:YES];
    RTMTask *taskOne = [tasks objectAtIndex:0];
    STAssertEquals(taskOne.priority, [NSNumber numberWithInteger:0], @&quot;priority check&quot;);
    STAssertEquals(taskOne.edit_bits, 0, @&quot;edit bits should flagged up&quot;);
@@ -46,7 +47,7 @@
 
 - (void) testAttributes
 {
-   NSArray *tasks = [tp tasks];
+   NSArray *tasks = [tp tasks:YES];
    RTMTask *first_task = [tasks objectAtIndex:0];
 
    STAssertEquals(first_task.iD, 1, @&quot;check attr&quot;);
@@ -71,53 +72,57 @@
 
 - (void) testTasksInList
 {
-   NSArray *tasks = [tp tasksInList:1];
+   NSArray *tasks = [tp tasksInList:1 showCompleted:YES];
    STAssertEquals([tasks count], 3U, @&quot;3 tasks should exist in list_id=1.&quot;);
 }
 
 - (void) testTasksInTags
 {
-   NSArray *tasks = [tp tasksInTag:1];
+   NSArray *tasks = [tp tasksInTag:1 showCompleted:YES];
    STAssertEquals(tasks.count, 1U, @&quot;should have some task elements in a index tag #1&quot;);
 }
 
 - (void) testZZZComplete
 {
-   NSUInteger completedCountBefore = [tp completedTasks].count;
-   RTMTask *taskOne = [[tp tasks] objectAtIndex:0];
+   NSUInteger completedCountBefore = [tp tasks:NO].count;
+   RTMTask *taskOne = [[tp tasks:YES] objectAtIndex:0];
 
    [taskOne complete];
    STAssertTrue([taskOne is_completed], @&quot;should be completed&quot;);
-   NSUInteger completedCountAfter = [tp completedTasks].count;
+   NSUInteger completedCountAfter = [tp tasks:NO].count;
    STAssertEquals(completedCountAfter, completedCountBefore-1, @&quot;completion check&quot;);
 }
 
 - (void) testZZZUncomplete
 {
-   NSUInteger completedCountBefore = [tp completedTasks].count;
-   RTMTask *taskTwo = [[tp tasks] objectAtIndex:1];
+   NSUInteger completedCountBefore = [tp tasks:NO].count;
+   RTMTask *taskTwo = [[tp tasks:YES] objectAtIndex:1];
 
    // complete first
    [taskTwo complete];
    STAssertTrue([taskTwo is_completed], @&quot;should be completed&quot;);
-   NSUInteger completedCountMiddle = [tp completedTasks].count;
+   NSUInteger completedCountMiddle = [tp tasks:NO].count;
    STAssertEquals(completedCountMiddle, completedCountBefore-1, @&quot;completion check&quot;);
 
    // then uncomplete
    [taskTwo uncomplete];
    STAssertFalse([taskTwo is_completed], @&quot;should not be completed&quot;);
-   NSUInteger completedCountFinally = [tp completedTasks].count;
+   NSUInteger completedCountFinally = [tp tasks:NO].count;
    STAssertEquals(completedCountFinally, completedCountMiddle+1, @&quot;uncompletion check&quot;);
 }
 
 - (void) testNotes
 {
-   RTMTask *first_task = [[tp tasks] objectAtIndex:0];
+   RTMTask *first_task = [[tp tasks:YES] objectAtIndex:0];
    NSArray *notes = first_task.notes;
    STAssertTrue(notes.count &gt; 0, @&quot;notes should be exist&quot;);
-   for (RTMNote *note in notes) {
-      NSLog(@&quot;note = (%@, %@)&quot;, note.title, note.text);
-   }
 }
 
-@end
\ No newline at end of file
+- (void) testTags
+{
+   RTMTask *first_task = [[tp tasks:YES] objectAtIndex:0];
+   NSArray *tags = first_task.tags;
+   STAssertTrue(tags.count &gt; 0, @&quot;tags should be exist&quot;);
+}
+
+@end</diff>
      <filename>test/TaskTest.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>32609a0325e011311507e18aafe46d8dd69da0a2</id>
    </parent>
  </parents>
  <author>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </author>
  <url>http://github.com/mootoh/milpon/commit/5154c1b6770f4d4886e21f38bb7dde1c23f32265</url>
  <id>5154c1b6770f4d4886e21f38bb7dde1c23f32265</id>
  <committed-date>2009-05-01T09:53:49-07:00</committed-date>
  <authored-date>2009-05-01T09:53:49-07:00</authored-date>
  <message>updated RTMTag model.</message>
  <tree>f29a885bdb663b53b1d89edad2994cc73ab5dfbd</tree>
  <committer>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </committer>
</commit>
