Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Metrics/App/WikiMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function saveMetrics(Wiki $wiki): void {
$quarterlyActions = $this->getNumberOfActions(self::INTERVAL_QUARTERLY);
$numberOfEntities = $this->getNumberOfEntities();
$monthlyNumberOfUsersPerActivityType = $this->getNumberOfUsersPerActivityType();
$numberOfUsersPerWiki = $wiki->wikiSiteStats()->first()->users ?? 0;
$numberOfUsers = $wiki->wikiSiteStats()->first()->users ?? 0;

$dailyMetrics = new WikiDailyMetrics([
'id' => $wiki->id . '_' . date('Y-m-d'),
Expand All @@ -55,7 +55,7 @@ public function saveMetrics(Wiki $wiki): void {
'entity_schema_count' => $numberOfEntities['640'],
'monthly_casual_users' => $monthlyNumberOfUsersPerActivityType[0],
'monthly_active_users' => $monthlyNumberOfUsersPerActivityType[1],
'total_user_count' => $numberOfUsersPerWiki,
'total_user_count' => $numberOfUsers,
]);

// compare current record to old record and only save if there is a change
Expand Down
5 changes: 3 additions & 2 deletions tests/Metrics/WikiMetricsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public function testSuccessfullyAddRecords() {
$wikiDb->update(['wiki_id' => $wiki->id]);

(new WikiMetrics)->saveMetrics($wiki);
// Assert the metric is updated in the database

// Assert new record is added to the database
$this->assertDatabaseHas('wiki_daily_metrics', [
'date' => now()->toDateString(),
]);
Expand Down Expand Up @@ -96,7 +97,7 @@ public function testAddRecordsWikiIsDeleted() {
]);
}

public function testItSaveTripleCountSuccessfully() {
public function testTripleCountSavedSuccessfully() {
$wiki = Wiki::factory()->create([
'domain' => 'somewikiforunittest.wikibase.cloud',
]);
Expand Down
Loading