Jump to content

Maintenance.php Bids removal


mseiwald

Recommended Posts

Hi guys i`ve got a problem with the maintenance.php and the bids removal.

I have set the local config to :

# If someone places a bid, whether to disable that or not

Config::Set('DISABLE_SCHED_ON_BID', true);

Config::Set('DISABLE_BIDS_ON_BID', false);

and in the maintenance.php i`ve activated this for the cron job:

if(Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === true)

{

SchedulesData::deleteExpiredBids();

CronData::set_lastupdate('check_expired_bids');

}

now the bids are removed after the period i`ve set but the flights don`t show up in my schedules again after the bid removal. So no one else can book them anymore.

any ideas what`s wrong here?

Would be nice if someone could help me with this because actually i have to delete all the affected flights in the admin panel and create a new flight in order to show them in my schedules again.

kind regards

Manuel

  • Like 1
Link to comment
Share on other sites

hi,

thanx for your reply!

but isn't it just excluding flights from the schedule that actually have open bids when this settings is "true"?

of course i want to hide flights that someone has booked but my problem is i've set the bid expiry to 72h and setup the maintenance.php cron job to close expired bids. so normally the flights should be available again in the schedule after the bid was deleted by the cron but it isn't. the bids get removed correctly after the 72h but the flights don't show up in the schedule again then.

kind regards

manuel

Link to comment
Share on other sites

  • 11 months later...

I'm facing the same problem as you, Manuel.

I'm still trying to fix it. By this time I am looking for grants to start repairing this issue.

For the time being, what I've realized is that bidid field in the schedules table in the database should be updated to zero when bids expires and maintainance.php does its job. And this is not happening... That's is our problem.

Whenever I get something, I'll post in here. The problem is I'm just a newbie in php programming... :rolleyes:

Link to comment
Share on other sites

Hello all and sorry my english,

i think Felipe is right the problem is when cron job do the work is not setting the scheduled bid (bidid) to 0 in schedules table.

You can check that, in your table and if is that the problem here is my code so you can try.

I´m not a pro coder, just works for me, maybe the function already exists or other faster way so here it is.

In your SchedulesData.class.php add the function

public function ResetSchedulesBidsExpired()
{

$bids = self::getSchedulesBidsExpired(true);
if(!$bids)
return true;

foreach($bids as $bid)
{
$sql = 'UPDATE '.TABLE_PREFIX.'schedules
SET `bidid`=0
WHERE `id`='.$bid->routeid;

DB::query($sql);
}

}

now in your admin/maintenance.php after SchedulesData::deleteExpiredBids(); add

SchedulesData::ResetSchedulesBidsExpired();

Hope it works for you

Link to comment
Share on other sites

Hello, Piuozorio!

It's great from hear the solution from you. I'll take a time tonight to check it and if it works for me I'll let you know.

By the way, I'm watching your badge and it says Eficiência 93%. By chance, has your VA developed a FOQA system based on phpVMS?

Thank you very much for your help!

Link to comment
Share on other sites

Hello, Piuozorio!

The cron is deleting the bid, but it still remains with some bidid set.

I'll test your query it with just...

$sql = 'UPDATE '.TABLE_PREFIX.'schedules SET `bidid`= 0;

... until I can figure out how to solve my problem definitely.

Link to comment
Share on other sites

Hello again,

i forgot to add the other function to work.

Add to schedulesData.class.php

public function getSchedulesBidsExpired()
{
$cache_time = Config::Get('BID_EXPIRE_TIME');
if($cache_time == '')
{
return;
}
$sql = 'SELECT *
FROM '.TABLE_PREFIX."bids
WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()";

$row = DB::get_results($sql);

 return $row;
}

Hope it works now :)

NOTE: I saw the other thread and is the "same code" all in one :)

I think i have edited the table bids to save date/time, not only date, because if is only date dont work properlly.

Lets say you have configured expire after 24 hours

You bid at 13:00 30/10/2012 and hope expired at 13:00 31/10/2012

Without the hours in database it expires (start) at 00:00 31/10/2012 and with the date only, yeh 30/10/2012 to 31/10/2012 is 24h

so with the hour it calculates well, only after 13:00 31/10/2012

I dont know if you understand what im saying, sorry my english :P

The "eficiência" was created with a help of a friend.

Just a php code that reads each line of log when "send pirep" and "before" enter in database.

Now in each line , i use this line code http://www.php.net/m...tion.substr.php to get the bold values,

[11:43] - Flaps to position 2 at 3169ft, hdg 3 and 200kts

It makes the "send pirep" time slower to read all code first and then get the "pirep filed".

Link to comment
Share on other sites

I did it and also added the function getSchedulesBidsExpired()

And still my expired bid are being deleted but the schedules are not being updated to zero on bidid column.

I've tried yours and Kyle's tips and nothing works for me.

Now I'm trying my own way... Let's see what happens... :(

Link to comment
Share on other sites

  • 5 months later...

Hello Kapitan, in fact i have for many time the same problem with the bids, my solution is not a good solution but it's work for the moment, I go to the database table phpvms_schedules at the column with name "bids" who show the flight who are on bids whit the numer "1" and no bids with numer "0", i just compare the current bids with the bid value in the column, if you have 5 currents bids you must have 5 flights with numer 1 on the column bids at shedules data base, finsh that i just change the value to "0" without "" and your flights wll be as on bid. Is not a good practice because you change values on database but with care it's work. I make this procedure weekly with no problem untill now.

According Felipe's post on April 5th i made a update with that files and the problem with bids is unsolved.....but i have erroneous data on my finances

finnace_1.jpg

Searching on files i found this code on core/common/LedgerData.class

http://www.transpola...ages/ledger.jpg

The values .$params['amount'].', NOW(), NOW() populate the table phpvms_ledger in the data base in the values `submitdate`and `modifieddate` with the present date and when the system makes the calculatin for pilotpay only shows the pilotpay for current months assuming all are reports are on this month instead by month due to the submit date is equal than modified date instead the submit date must have the date when the pirep was sent.

Regards.

Luis

  • Like 1
Link to comment
Share on other sites

Hello Kapitan, in fact i have for many time the same problem with the bids, my solution is not a good solution but it's work for the moment, I go to the database table phpvms_schedules at the column with name "bids" who show the flight who are on bids whit the numer "1" and no bids with numer "0", i just compare the current bids with the bid value in the column, if you have 5 currents bids you must have 5 flights with numer 1 on the column bids at shedules data base, finsh that i just change the value to "0" without "" and your flights wll be as on bid. Is not a good practice because you change values on database but with care it's work. I make this procedure weekly with no problem untill now.

Accordin the Felipe post on April 5th i made a update with that files and the problem with bids is unsolved.....but i have erroneous data on my finances

finnace_1.jpg

Cheers m8 ...i know thats what im doing now.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...