mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 08:57:54 +00:00
Analytics over top contributors, change loyalty plan slug
This commit is contained in:
1 parent
c1860a0584
commit
2e561acbb4
2 files changed
+46
-3
No files matched your search
@@ -0,0 +1,43 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Top TTS model uploaders
|
||||
select
|
||||
u.id,
|
||||
u.token,
|
||||
u.username,
|
||||
u.created_at,
|
||||
u.maybe_loyalty_program_key,
|
||||
m.upload_count
|
||||
from users as u
|
||||
join
|
||||
(
|
||||
select
|
||||
count(*) as upload_count,
|
||||
creator_user_token
|
||||
from tts_models
|
||||
group by creator_user_token
|
||||
order by upload_count desc
|
||||
) as m
|
||||
on u.token = m.creator_user_token
|
||||
where m.upload_count >= 5;
|
||||
|
||||
|
||||
|
||||
-- Upgrade top TTS model uploaders to a loyalty plan
|
||||
update users
|
||||
set maybe_loyalty_program_key = 'fakeyou_contributor'
|
||||
where token IN (
|
||||
select creator_user_token from
|
||||
(
|
||||
select count(*) as upload_count,
|
||||
creator_user_token
|
||||
from tts_models
|
||||
group by creator_user_token
|
||||
having upload_count >= 10
|
||||
order by upload_count desc
|
||||
) as t
|
||||
);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub static FREE_LOGGED_IN_PLAN : Lazy<Plan> = Lazy::new(|| {
|
||||
pub static LOYALTY_PLANS : Lazy<HashSet<Plan>> = Lazy::new(|| {
|
||||
let mut plans = HashSet::new();
|
||||
|
||||
plans.insert(PlanBuilder::new("loyalty_plan")
|
||||
plans.insert(PlanBuilder::new("fakeyou_contributor")
|
||||
.is_synthetic_plan(true)
|
||||
.plan_category(PlanCategory::LoyaltyReward)
|
||||
.tts_base_priority_level(2)
|
||||
@@ -319,7 +319,7 @@ mod test {
|
||||
assert_eq!(1, ALL_PLANS_BY_SLUG.get("free_logged_in").unwrap().tts_base_priority_level());
|
||||
|
||||
// Loyalty-based
|
||||
assert_eq!(2, ALL_PLANS_BY_SLUG.get("loyalty_plan").unwrap().tts_base_priority_level());
|
||||
assert_eq!(2, ALL_PLANS_BY_SLUG.get("fakeyou_contributor").unwrap().tts_base_priority_level());
|
||||
|
||||
// Premium (Production)
|
||||
assert_eq!(10, ALL_PLANS_BY_SLUG.get("fakeyou_basic").unwrap().tts_base_priority_level());
|
||||
@@ -341,7 +341,7 @@ mod test {
|
||||
assert_eq!(12, ALL_PLANS_BY_SLUG.get("free_logged_in").unwrap().tts_max_duration().num_seconds());
|
||||
|
||||
// Loyalty-based
|
||||
assert_eq!(30, ALL_PLANS_BY_SLUG.get("loyalty_plan").unwrap().tts_max_duration().num_seconds());
|
||||
assert_eq!(30, ALL_PLANS_BY_SLUG.get("fakeyou_contributor").unwrap().tts_max_duration().num_seconds());
|
||||
|
||||
// Premium (Production)
|
||||
assert_eq!(30, ALL_PLANS_BY_SLUG.get("fakeyou_basic").unwrap().tts_max_duration().num_seconds());
|
||||
|
||||
Reference in new issue
Block a user