Changeset 444

Show
Ignore:
Timestamp:
08/07/09 09:33:09 (11 years ago)
Author:
kovell
Message:

Fixes: eve-central sync formula modified. More errors caught.

Location:
dev/common/includes
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dev/common/includes/eve_central_sync.php

    r428 r444  
    8888 
    8989        file_put_contents(KB_CACHEDIR.'/evecentral/activity.log', "$content\n", FILE_APPEND); 
    90          
     90 
    9191        $query->execute("REPLACE INTO kb3_eve_central (item_id, item_price) VALUES ($item_id, '$weighted_average')"); 
    9292        return $weighted_average; 
     
    111111    // The destroyed items etc feed in the -internal- killboard item ID. 
    112112    // EVE Central needs the external ID if we have it. 
    113     $query->execute("SELECT typeID FROM kb3_invTypes WHERE typeID=$item_id"); 
     113    $query->execute("SELECT typeID FROM kb3_invtypes WHERE typeID=$item_id"); 
    114114    $data = $query->getRow(); 
    115115    $e_item_id = $data['typeID']; 
     
    122122    $value = ec_get_value($e_item_id); 
    123123    if (-99 != $value) { 
    124             $query->execute("update kb3_item_price set price='$value' WHERE typeID=$item_id"); 
    125             return true; 
     124                $query->execute("update kb3_item_price set price='$value' WHERE typeID=$item_id"); 
     125                return true; 
    126126    } else { 
    127127            file_put_contents(KB_CACHEDIR.'/evecentral/activity.log', "Failed to find it.\n", FILE_APPEND); 
    128     } 
     128        } 
    129129    return false; 
    130130} 
    131131 
    132132class XMLParser { 
    133     private $allKinds = 0; 
    134     private $data = array(); 
    135     private $tagName = ""; 
    136     private $singluar = ""; 
    137     private $parser = null; 
    138133 
    139134    function preparseXML() { 
     
    154149            case "SELL": { $this->allKinds = 3; break; } 
    155150        } 
    156         $this->singluar = null; 
     151        $this->singular = null; 
    157152        $this->tagName = $tag; 
    158153    } 
     
    160155    /*The space between tags is interpreted here.*/ 
    161156    function cdata($parser, $cdata) { 
    162         $this->singluar .= $cdata; 
     157        $this->singular .= $cdata; 
    163158    } 
    164159 
     
    167162        switch($this->allKinds) { 
    168163            case 2: { 
    169                 if($tag == "AVG") { 
    170                     $this->data['BUY_AVG'] = $this->singluar; 
     164                if($tag == "MEDIAN") { 
     165                    $this->data['BUY_MED'] = $this->singular; 
    171166                } 
    172167                break; 
    173168            } 
    174169            case 3: { 
    175                 if($tag == "AVG") { 
    176                     $this->data['SELL_AVG'] = $this->singluar; 
    177                     $this->data['WEIGHTED'] = round(((($this->data['BUY_AVG'] * 1.6) + ($this->data['SELL_AVG'] + 0.8))) / 2, 2); 
     170                if($tag == "MEDIAN") { 
     171                    $this->data['SELL_MED'] = $this->singular; 
     172                    $this->data['WEIGHTED'] = round(((($this->data['BUY_MED'] * 1.4) + ($this->data['SELL_MED'] * 0.6))) / 2, 2); 
    178173                } 
    179174                break; 
  • dev/common/includes/globals.php

    r443 r444  
    77else 
    88{ 
    9         $svn_rev = '443'; 
     9        $svn_rev = '444'; 
    1010} 
    1111define('SVN_REV', $svn_rev);