public function index() { $this->set_title("Tag Aliases"); if ($this->params()->commit == "Search Implications") { $this->redirectTo(array('tag_implication#index', 'query' => $this->params()->query)); return; } if ($this->params()->query) { $name = "%" . $this->params()->query . "%"; $this->aliases = TagAlias::where("name LIKE ? OR alias_id IN (SELECT id FROM tags WHERE name LIKE ?)", $name, $name)->order("is_pending DESC, name")->paginate($this->page_number(), 20); } else { $this->aliases = TagAlias::order("is_pending DESC")->paginate($this->page_number(), 20); } $this->respond_to_list('aliases'); }
public function pretty_data() { switch ($this->task_type) { case "mass_tag_edit": $start = $this->data["start_tags"]; $result = $this->data["result_tags"]; $user = User::find_name($this->data["updater_id"]); return "start: " . $start . ", result: " . $result . ", user: "******"approve_tag_alias": $ta = TagAlias::where('id', $this->data->id)->first(); if (!$ta) { Rails::log()->warning(sprintf("Tag alias #%s couldn't be found for job task #%s. Destroying job task.", $this->data->id, $this->id)); $this->destroy(); return "Error - Tag alias doesn't exist"; } return "start: " . $ta->name . ", result: " . $ta->alias_name(); break; case "approve_tag_implication": $ti = TagImplication::where('id', $this->data->id)->first(); if (!$ti) { Rails::log()->warning(sprintf("Tag implication #%s couldn't be found for job task #%s. Destroying job task.", $this->data->id, $this->id)); $this->destroy(); return "Error - Tag implication doesn't exist"; } return "start: " . $ti->predicate->name . ", result: " . $ti->consequent->name; break; case "calculate_tag_subscriptions": return "last run: " . (isset($this->data->last_run) ? $this->data->last_run : 'never'); break; // case "upload_posts_to_mirrors" // ret = "" // if data["post_id"] // ret << "uploading post_id #{data["post_id"]}" // elsif data["left"] // ret << "sleeping" // else // ret << "idle" // end // ret << (" (%i left) " % data["left"]) if data["left"] // ret // case "upload_posts_to_mirrors" // ret = "" // if data["post_id"] // ret << "uploading post_id #{data["post_id"]}" // elsif data["left"] // ret << "sleeping" // else // ret << "idle" // end // ret << (" (%i left) " % data["left"]) if data["left"] // ret case "periodic_maintenance": if ($this->status == "processing") { return !empty($this->data->step) ? $this->data->step : 'unknown'; } elseif ($this->status != "error") { $next_run = (!empty($this->data->next_run) ? strtotime($this->data->next_run) : 0) - time(); $next_run_in_minutes = $next_run / 60; if ($next_run_in_minutes > 0) { $eta = "next run in " . round($next_run_in_minutes / 60.0) . " hours"; } else { $eta = "next run imminent"; } return "sleeping (" . $eta . ")"; } break; case "external_data_search": return 'last updated post id: ' . (isset($this->data->last_post_id) ? $this->data->last_post_id : '(none)'); break; case "upload_batch_posts": if ($this->status == "pending") { return "idle"; } elseif ($this->status == "processing") { $user = User::find_name($this->data->user_id); return "uploading " . $this->data->url . " for " . $user; } break; // case "update_post_frames" // if status == "pending" then // return "idle" // elsif status == "processing" then // return data["status"] // end // end } }