view data fixes
This commit is contained in:
@@ -9,19 +9,18 @@ import { AnalyticsDashboardInputViewData } from "../view-data/AnalyticsDashboard
|
||||
import { ViewModel } from "../contracts/view-models/ViewModel";
|
||||
|
||||
export class AnalyticsDashboardViewModel extends ViewModel {
|
||||
readonly totalUsers: number;
|
||||
readonly activeUsers: number;
|
||||
readonly totalRaces: number;
|
||||
readonly totalLeagues: number;
|
||||
private readonly data: AnalyticsDashboardInputViewData;
|
||||
|
||||
constructor(viewData: AnalyticsDashboardInputViewData) {
|
||||
constructor(data: AnalyticsDashboardInputViewData) {
|
||||
super();
|
||||
this.totalUsers = viewData.totalUsers;
|
||||
this.activeUsers = viewData.activeUsers;
|
||||
this.totalRaces = viewData.totalRaces;
|
||||
this.totalLeagues = viewData.totalLeagues;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
get totalUsers(): number { return this.data.totalUsers; }
|
||||
get activeUsers(): number { return this.data.activeUsers; }
|
||||
get totalRaces(): number { return this.data.totalRaces; }
|
||||
get totalLeagues(): number { return this.data.totalLeagues; }
|
||||
|
||||
/** UI-specific: User engagement rate */
|
||||
get userEngagementRate(): number {
|
||||
return this.totalUsers > 0 ? (this.activeUsers / this.totalUsers) * 100 : 0;
|
||||
|
||||
Reference in New Issue
Block a user