#include "ActiveCommand.h" #include "Error.h" #include "Manager.h" using util::Util; using util::Manager; using err::Error; namespace commands { ActiveCommand::ActiveCommand() : SubCommand("active", false) { } void ActiveCommand::run(stringstream& args) { Manager* mgr = Manager::get_instance(); int user_id; args >> user_id; if (!args) throw Error(102, "Ein Parameter eines Befehls konnte nicht gelesen werden"); const User* u = mgr->get_user(user_id); if (!u) throw Error(401, "Eine solche BenutzerIn existiert nicht."); for (const Assignment* a : mgr->get_assignments_for_user(user_id)) { //Ist der Related Task ein Aktiver Task? if (mgr->get_task(a->get_task_id())->is_active()) { cout << a->get_task_id() << "\n"; } } } } // commands