Changeset 1191588
- Timestamp:
- 07/03/2015 04:46:31 AM (11 years ago)
- Location:
- iterative-headlines
- Files:
-
- 2 edited
-
tags/1.3/headlines_api.php (modified) (4 diffs)
-
trunk/headlines_api.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
iterative-headlines/tags/1.3/headlines_api.php
r1191569 r1191588 80 80 $parameters = ['experiment_id' => $post_id, 'unique_id' => $unique_id, 'type'=>$type, 'variants' => json_encode($send), 'meta' => json_encode($meta)]; 81 81 $response = static::makeRequest("experiment", $parameters); 82 die(); 82 83 83 $response['timestamp'] = time(); 84 84 update_post_meta($post_id, "_iterative_parameters_{$type}", $response); … … 166 166 public static function selectVariant($post_id, $variant_hashes) { 167 167 // support models. 168 if(count($variant_hashes) == 1) 169 return current($variant_hashes); 168 170 169 171 $user_id = static::getUserID(); … … 176 178 $type = static::getType(); 177 179 $models = get_post_meta($post_id, "_iterative_models_{$type}", true); 180 178 181 $best_model = current($models); 179 182 $second_model = current($models); … … 203 206 public static function tellServerVariantForUserID($unique_id, $user_id, $hash, $post_id) { 204 207 $variants = get_post_meta($post_id, "_iterative_variants", true); 205 if(isset($variants[$user_id]) && $variants[$user_id] == $hash) return; 208 if(isset($variants[$user_id]) && $variants[$user_id] == $hash) 209 return; 206 210 $parameters = ['unique_id' => $unique_id, 'user'=>$user_id, 'variant'=>$hash, 'experiment_id' => $post_id]; 207 211 static::makeRequest("variant", $parameters); -
iterative-headlines/trunk/headlines_api.php
r1191569 r1191588 80 80 $parameters = ['experiment_id' => $post_id, 'unique_id' => $unique_id, 'type'=>$type, 'variants' => json_encode($send), 'meta' => json_encode($meta)]; 81 81 $response = static::makeRequest("experiment", $parameters); 82 die(); 82 83 83 $response['timestamp'] = time(); 84 84 update_post_meta($post_id, "_iterative_parameters_{$type}", $response); … … 166 166 public static function selectVariant($post_id, $variant_hashes) { 167 167 // support models. 168 if(count($variant_hashes) == 1) 169 return current($variant_hashes); 168 170 169 171 $user_id = static::getUserID(); … … 176 178 $type = static::getType(); 177 179 $models = get_post_meta($post_id, "_iterative_models_{$type}", true); 180 178 181 $best_model = current($models); 179 182 $second_model = current($models); … … 203 206 public static function tellServerVariantForUserID($unique_id, $user_id, $hash, $post_id) { 204 207 $variants = get_post_meta($post_id, "_iterative_variants", true); 205 if(isset($variants[$user_id]) && $variants[$user_id] == $hash) return; 208 if(isset($variants[$user_id]) && $variants[$user_id] == $hash) 209 return; 206 210 $parameters = ['unique_id' => $unique_id, 'user'=>$user_id, 'variant'=>$hash, 'experiment_id' => $post_id]; 207 211 static::makeRequest("variant", $parameters);
Note: See TracChangeset
for help on using the changeset viewer.