-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathWikiDailyMetrics.php
More file actions
67 lines (55 loc) · 1.52 KB
/
WikiDailyMetrics.php
File metadata and controls
67 lines (55 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class WikiDailyMetrics extends Model {
use HasFactory;
protected $table = 'wiki_daily_metrics';
protected $primaryKey = 'id';
public $incrementing = false; // Disable auto-increment
protected $keyType = 'string';
protected $fillable = [
'id',
'wiki_id',
'date',
'pages',
'is_deleted',
'daily_actions',
'weekly_actions',
'monthly_actions',
'quarterly_actions',
'number_of_triples',
'item_count',
'property_count',
'lexeme_count',
'entity_schema_count',
'monthly_casual_users',
'monthly_active_users',
'wiki_user_count',
];
// list of properties which are actual wiki metrics
public static $metricNames = [
'pages',
'is_deleted',
'daily_actions',
'weekly_actions',
'monthly_actions',
'quarterly_actions',
'number_of_triples',
'item_count',
'property_count',
'lexeme_count',
'entity_schema_count',
'monthly_casual_users',
'monthly_active_users',
'wiki_user_count',
];
public function areMetricsEqual(WikiDailyMetrics $wikiDailyMetrics): bool {
foreach (self::$metricNames as $field) {
if ($this->$field != $wikiDailyMetrics->$field) {
return false;
}
}
return true;
}
}