Conversation
…sadev/lemmy into additional-statistics-scheduled-task
| ADD COLUMN total_communities integer; | ||
|
|
||
| ALTER TABLE local_site | ||
| ADD COLUMN user_retention_percent integer; |
There was a problem hiding this comment.
All the percentages/rates should probably be floats.
| ALTER TABLE local_site | ||
| ADD COLUMN local_post_english_percent integer; |
There was a problem hiding this comment.
Not sure how useful this metric would be. I spose it could be useful for servers who are multi-lingual, and wanting to try to get rid of english usage.
There was a problem hiding this comment.
Yeah it shouldnt be limited to a single language, but have usage percentage for every language. Maybe with a new column language.usage_percentage.
There was a problem hiding this comment.
I added language_usage_percent jsonb column. It will contain something like:
{
"en" : "30.10",
"und": "10.00",
"de": "59.90"
}There was a problem hiding this comment.
I'm not a fan of slamming json into sql, we really should try to avoid that. Either add a new table, or better yet just remove this.
There was a problem hiding this comment.
Best put it in the existing language table.
- Rename `users/posts/comments/communities` to `local_users/local_posts/local_comments/local_communities` to distinguish from the new total_* columns - Add `NOT NULL DEFAULT 0` to all new statistics columns (linked_instances, total_*, rates) instead of nullable - Update triggers.sql, nodeinfo.rs, convert.rs, and tests to use new column names
Issue: #6288
Summary of changes:
In
local_sitetable:posts,users, (and others) tolocal_posts,local_users, etc.total_posts,total_users, etclanguage_usage_percentjsonbcolumn with a non null constraint and default value{}There were tests that were exercising some trigger logic in the db so I fixed the db triggers/functions here.
update_statsmethod which runs some basics queries and updateslocal_sitetable and added it to the daily scheduled tasksprocess_language_breakdown(runs as part ofupdate_stats) which calculates the percentage breakdown of posts per language tag and updates the newly addedlanguage_usage_percentfield inlocal_sitetabletest_update_statsandtest_process_language_breakdowntests--features fullflag to./scripts/dump_schema.rsOutstanding items: