Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

统计用户活动数据 #30

Open
TechQuery opened this issue Oct 19, 2024 · 0 comments
Open

统计用户活动数据 #30

TechQuery opened this issue Oct 19, 2024 · 0 comments
Assignees
Labels
feature New feature or request

Comments

@TechQuery
Copy link
Member

原始数据

@Entity()
export class CheckEvent extends UserBase {
@IsLatLong()
@IsOptional()
@Column({ nullable: true })
coordinate?: string;
@Type(() => User)
@ValidateNested()
@ManyToOne(() => User)
user: User;
@IsString()
@Column()
activityId: string;
@IsString()
@Column()
activityName: string;
@IsString()
@Column()
agendaId: string;
@IsString()
@Column()
agendaTitle: string;
}

参考视图

@ViewEntity({
expression: connection =>
connection
.createQueryBuilder()
.from(ActivityLog, 'al')
.groupBy('al.createdBy')
.select('al.createdBy.id', 'userId')
.addSelect('COUNT(al.id)', 'score')
})
export class UserRank {
@IsInt()
@Min(1)
@ViewColumn()
userId: number;
@Type(() => User)
@ValidateNested()
user: User;
@ViewColumn()
score: number;
@IsInt()
@Min(1)
rank: number;
}

统计维度

  1. 一个用户在不同活动中的打卡数量,反映其对不同活动的喜爱程度。
  2. 一场活动不同议程的打卡数量,反映各议程的受欢迎程度。
  3. 不同活动各自的打卡总数,反映它们的受欢迎程度。
@TechQuery TechQuery added the feature New feature or request label Oct 19, 2024
@Soecka Soecka self-assigned this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Development

No branches or pull requests

2 participants