Closed dxops closed 11 years ago
Yes you can! This is why there is a destKey (2nd arg). You can also use the destKey as a key in another call.
In the 'blocked:users
do you have elements within the date range?
Sure, full test:
public function testThatBitterMarkIncrementAndGetValue()
{
$dateTime = new \DateTime();
$dayActive = new Day('active', $dateTime);
$dayBlocked = new Day('blocked', $dateTime);
$this->bitter->mark('active', 1);
$this->bitter->mark('active', 2);
$this->assertEquals(2, $this->bitter->count($dayActive));
$from = new \DateTime('-1 day');
$to = new \DateTime('+1 day');
$this->bitter->mark('active', 3);
$this->bitter->mark('blocked', 4);
$this->bitter->mark('blocked', 5);
$this->bitter->mark('blocked', 6);
$this->bitter->mark('blocked', 7);
$this->assertEquals(3, $this->bitter->count($dayActive));
$this->assertEquals(4, $this->bitter->count($dayBlocked));
$this->assertEquals(7, $this->bitter->count($dayBlocked) + $this->bitter->count($dayActive));
$this->bitter->bitDateRange('active', 'active_users_period', $from, $to);
$this->assertEquals(3, $this->bitter->count('active_users_period'));
$this->bitter->bitDateRange('blocked', 'blocked_users_period', $from, $to);
$this->assertEquals(4, $this->bitter->count('blocked_users_period'));
}
@jeremyFreeAgent getting error on last assert
@jeremyFreeAgent any suggestions?
@sergeyz I'm on it. I've the same issue... very strange.
i found that second period key blocked_users_period
is not created
$from and $to date were modified in method and second call was made with wrong dates
is it possible to use bitDateRange twice within one bitter intance?
second count is 0