Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rerank
  • Loading branch information
Joel Salisbury committed Jan 24, 2019
1 parent 3df56b6 commit 477f15a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions swap-api/src/routes.php
Expand Up @@ -27,6 +27,46 @@ $app->get('/food/all/', function($request, $response) {
return $response->getBody()->write(Food::all()->toJson());
});

// $app->get('/reRankAllFoods', function($request, $response){
// ini_set('max_execution_time', 300);
// $foods = Food::all();

// $nix_appID = "e2153d42";
// $nix_appKey = "ccb97a64a7b7b1b8f7e64de881c9ee4b";


// foreach($foods as $food) {
// $upc = $food->barcode;
// $catId = $food->category_id;
// $endpoint = "http://api.nutritionix.com/v1_1/item?upc=".$upc.
// "&appId=".$nix_appID.
// "&appKey=".$nix_appKey;

// //echo $endpoint;
// $ch = curl_init($endpoint);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// $res = curl_exec($ch);
// curl_close($ch);

// $res = json_decode($res);

// if (!isset($res->error_code)) {

// $food->category()->associate($catId);

// $scr = getScore($catId, array(
// "sodium" => $res->nf_sodium,
// "satfat" => $res->nf_saturated_fat,
// "sugars" => $res->nf_sugars
// ));

// $food->rank()->associate($scr);

// $food->save();
// }
// }
// });

$app->get('/pinfo/', function($request, $response) {
return phpinfo();
});
Expand Down

0 comments on commit 477f15a

Please sign in to comment.