Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2013, 06:00 PM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 23,859
Infernette is on a distinguished road
Default A way to exclude pets from daycare?

I was wondering if there was a way to exclude pets from the daycare once clicked for the day, I know there is ways to tell if the pet is clicked but I don't know how to exclude it from the query.
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #2  
Old 08-05-2013, 12:41 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,373
IntoRain is on a distinguished road
Default

Maybe you have to add a "wasClicked" attribute to the tables? I did this little crappy code down here, I'm pretty sure it has bugs and maybe it's not the best solution (when I ask for a sizeof of the array it outputs 34 instead of 33, so it's doing extra stuff :D), but hey it's a start... right?

I don't know the documentation of this project, what the functions do etc... I'm pretty new xDWe have to try to find out where to restrict addition of adoptables to the daycare. That's the getConditions() function.
The basic idea was to take the IDs that have been clicked and compare the adoptable id to them. This condition is saved in the $conditions variable that will be used when selecting adoptables from owned_adoptables in the function above getConditions() (I believe it's getAdopts()).

In the class_daycare, getConditions(), before returning:

PHP Code:
      $date = new DateTime;
               
$datetime $date->format('Y-m-d');
                
$user $mysidia->user;
                
//take adoptable IDs that have been clicked by the user in today's date
        
$idsM $mysidia->db->select("vote_voters", array("adoptableid"), "date='{$datetime}' and username='{$user->username}'")->fetchAll(PDO::FETCH_COLUMN);
        
$adoptsIDs = new ArrayObject($idsM);
        
//append to the conditions string an aid restrictions (aid can't be equal to the IDs in idsM) - yes, for each adoptable it has to compare its ID to all of the IDs ._.
        
for($index 0$index sizeof($adoptsIDs); $index++)
        {
            
//echo $datetime;
            
$conditions .= " and aid != '{$adoptsIDs[$index]}'";
        } 
I only tested it twice with two different users... It seems to work with today's date, but when using writing down a specific date (yesterday's date) it returned 34 instead of 33, so I don't know what it's doing as an extra? This is not a good solution, but maybe it will help you somehow :/ edit: hm, I counted wrong... Apparently everything's fine(?), but still it's not an optimal solution (the amount of comparisons it has to do...) And it only works if you refresh the page, so it won't take out an egg from the daycare when it's clicked of course, it updates the array after refresh

I also tried to restrict their appearance (in levelup, in daycare() function) instead of restricting addition, but I don't really know how the page is set up so it was errors after errors.

Last edited by IntoRain; 08-05-2013 at 01:38 AM.
Reply With Quote
  #3  
Old 08-05-2013, 10:05 AM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 23,859
Infernette is on a distinguished road
Default

That works perfectly! Refeshing is what I meant, and it seems to flow nicely (I also have an upgraded server package so yeah, dunno how well it'd work for free hosters. XD)
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #4  
Old 08-05-2013, 10:20 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,373
IntoRain is on a distinguished road
Default

I love your site so Glad I could help! I really don't know another way other than comparing IDs, but the increasing number of IDs worries me xD Constructing another table not_clicked and selecting from owned_adoptables MINUS selecting from vote_voters, but I really don't know how to work with the date there xD But if it works I'm glad I could help ^^

Last edited by IntoRain; 08-05-2013 at 11:07 AM.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when I go to daycare or my adopts ilrak Questions and Supports 0 09-10-2014 04:15 PM
Only display pets a user hasn't clicked in daycare Hwona Suggestions and Feature Requests 3 08-16-2014 04:53 PM
A way to make rounded borders around daycare pets? Infernette Questions and Supports 14 09-10-2013 09:08 PM
pets dradar Questions and Supports 5 08-06-2010 05:48 PM
I don't see my pets...help sdsmith64 Questions and Supports 8 07-27-2009 06:03 PM


All times are GMT -5. The time now is 05:10 AM.

Currently Active Users: 9722 (0 members and 9722 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636