Author Topic: Randomize show date of galleries in database  (Read 1603 times)

0 Members and 1 Guest are viewing this topic.

Offline bbhrucy79

  • Newbie
  • *
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Randomize show date of galleries in database
« on: March 02, 2013, 02:48:17 AM »
hi,

What if, you import thousands of galleries on the same day. In this way, even if you set up a hall of fame template, with minage and maxage, on page rebuilds (with new), the hall of fame block will be empty. Is there a way around this. I mean what code to use to make sure that the hall of fame is never empty? Thanks :-)

Offline bbhrucy79

  • Newbie
  • *
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Re: Randomize show date of galleries in database
« Reply #1 on: April 07, 2013, 11:45:10 PM »
bump

Offline Chad

  • Administrator
  • Full Member
  • ***
  • Posts: 215
  • Karma: +27/-0
    • View Profile
Re: Randomize show date of galleries in database
« Reply #2 on: April 09, 2013, 06:41:09 PM »
Have you tried the shuffle script in the utils diretcory? I just can't remember at the moment if this changes dates or just gallery ID's.  I'm thinking it was gallery ID's so I guess that wouldn't help much.

Offline Chad

  • Administrator
  • Full Member
  • ***
  • Posts: 215
  • Karma: +27/-0
    • View Profile
Re: Randomize show date of galleries in database
« Reply #3 on: April 09, 2013, 06:57:55 PM »
Yea, that just does ID's.  I seem to remember working on the shuffle script to do something else but again, I can't remember at the moment what it was.  I'll see if I can dig it up and find out.

Offline Chad

  • Administrator
  • Full Member
  • ***
  • Posts: 215
  • Karma: +27/-0
    • View Profile
Re: Randomize show date of galleries in database
« Reply #4 on: April 09, 2013, 07:25:25 PM »
I remember what it was.  Wasn't for TGPX. Was TubeX.  I tried to port the shuffle script for use on the videos.  Seemed to work on my site but the other person that was looking to do it said that it didn't work on his...

Here is something that I found.  Not a 100% answer but you might find someone that can help.

http://acsummer.wordpress.com/2008/01/30/quick-answer-add-random-dates-to-mysql-database/

In the comments to that post:

Code: [Select]
UPDATE tablename SET datefield= ’2005-01-01′ + interval rand()*883 day where ’2005-01-01′ is the base date and 883 is the number days (maximum) you can go past the base date.
This will fill in each rows datefield with a random date between 2005-01-01 and 2006-06-02.

You would have to tweak it a bit to match your tables and dates.  I beleive you would also have to write the date into both date_added and date_approved fields in the DB.

I don't know  a lot about MYsql so you will have to find someone that knows more.  Hopefully the above will help as a starting point.

Thanks,
Chad

Offline bbhrucy79

  • Newbie
  • *
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Re: Randomize show date of galleries in database
« Reply #5 on: May 06, 2013, 03:59:32 AM »
Hello,

Thank you for your help! Surely, thats whats needs to be done. Shuffling the approval dates random. I am looking into this and will post if I find successful way to do this in mysql. Cheers!

Offline bbhrucy79

  • Newbie
  • *
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Re: Randomize show date of galleries in database
« Reply #6 on: May 06, 2013, 04:29:48 AM »
Just a quick update if anyone else runs into this problem, the above method worked! The table you are looking for is tx_galleries and you want to update the date_approved field. works like a charm :-)

Unofficial JMB Support Forums

Re: Randomize show date of galleries in database
« Reply #6 on: May 06, 2013, 04:29:48 AM »


Tags:
 

Related Topics

  Subject / Started by Replies Last post
0 Replies
1170 Views
Last post August 05, 2013, 07:04:44 PM
by Chad
0 Replies
635 Views
Last post October 01, 2013, 05:21:40 AM
by kamtcho
3 Replies
2263 Views
Last post March 14, 2016, 07:52:59 PM
by longsack
0 Replies
899 Views
Last post February 06, 2014, 07:17:17 AM
by gigasexo
1 Replies
1706 Views
Last post March 07, 2015, 05:53:12 AM
by amebb