Jump to content

Ranks Autocalculate


mseiwald

Recommended Posts

Hi guys,

can someone please point me in the right direction where all the rank autocalculate functions are.

I want to exclude some pilots who got a rank Upgrade from the autocalculate. I have added a if statement there to the PIREP Accept function in the pirep admin module. It is working there but it seems there must be autocalculate functions somewhere else as well cause the pilots keep getting reset to their autocalculated rank.

best regards

Manuel

Link to comment
Share on other sites

Exactly i want to have the Ranks autocalculated by default but have some guys excluded who got a special rank Upgrade. I have added a column in a table for that and also have a working if statement. I just need to find all spots where i need to apply this if statement. So far i have the pirep admin module but it seems that there are also some autocalculate functions somewhere else.

Link to comment
Share on other sites

  • Moderators

This one is in PilotData.class.php:

public static function changePilotRank($pilotid, $rankid) {

 $rank = RanksData::getRankInfo($rankid);
 if (!($rank_level = RanksData::getRankLevel($rankid))) {
	 return false;
 }

 return self::updateProfile($pilotid, array(
	 'rankid' => $rank->rankid,
	 'rank' => $rank->rank,
	 'ranklevel' => $rank_level
 ));
}

And this is in RanksData.class.php:

public static function calculatePilotRanks() {

 /* Don't calculate a pilot's rank if this is set */
 if (Config::Get('RANKS_AUTOCALCULATE') === false) {
	 return;
 }

 $ranks_list = self::getAllRanks();
 $pilots = PilotData::getAllPilots();
 if (count($pilots) == 0 || !is_array($pilots)) {
	 return;
 }

 foreach ($pilots as $pilot) {
	 self::calculateUpdatePilotRank($pilot->pilotid, $ranks_list);
 }
}

Hope these help. :D

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...