Can I restore visit streaks?

Hello,

Recently my forum had an extended 2 day downtime because of issues with our domain.

That caused everybody’s visit streaks to break, which is very bad to most people.

I’m looking to restore these, how can I?

1 Like

You’d need to contrive to add data to the tables to make it look like everyone visited on those days. You’d need to read the source, figure out which tables need to add rows to, and then create records on them for each user.

If you don’t know how to do that and do not get a response quickly enough, you can post a budget in #marketplace.

2 Likes

They need to get their priorities straight :wink:

Anyway, to copy visits from one day to another you need to run this SQL query

insert into user_visits
  select 0, user_id, '2022-09-09', posts_read, mobile, 0 
  from user_visits 
  where visited_at = '2022-09-08'
;

where the first date is the date you want to fake and the second date is where you want to copy from.

6 Likes

Richard saves the day again! What a great solution. I was wondering how to do it without just giving everyone credit. Brilliant!

4 Likes

You would be shocked the amount of people that complained about it :face_with_diagonal_mouth:

Thanks for the script, where can I run it?

2 Likes
cd /var/discourse
./launcher enter app
rails c
DB.exec("insert into user_visits select 0, user_id, '2022-09-09', posts_read, mobile, 0 from user_visits where visited_at = '2022-09-08'")
3 Likes