Example #1
0
    });
    $this->get('/{team:[0-9]{1,4}}', function ($req, $res, $args) {
        Auth::redirectIfNotLoggedIn();
        $team = FileReader::getTeam($args['team']);
        if (!$team) {
            Downloader::getTeam($args['team']);
            header('Refresh:0');
        }
        $events = FileReader::getEventsForTeam($args['team']);
        if (!$events) {
            Downloader::getEventsForTeam($args['team']);
            header('Refresh:0');
        }
        $comments = Comment::where('team_id', $team->team_number);
        $defense = Defense::where('team_id', $args['team'])->orderBy('id', 'desc')->first();
        $defenses = array();
        $author = $defense ? $defense->author : false;
        if ($defense) {
            $defenses['Low Bar'] = $defense->low_bar;
            $defenses['Portcullis'] = $defense->portcullis;
            $defenses['Cheval de Frsie'] = $defense->cheval_de_frise;
            $defenses['Moat'] = $defense->moat;
            $defenses['Ramparts'] = $defense->ramparts;
            $defenses['Drawbridge'] = $defense->drawbridge;
            $defenses['Sally Port'] = $defense->sally_port;
            $defenses['Rock Wall'] = $defense->rock_wall;
            $defenses['Rough Terrain'] = $defense->rough_terrain;
        }
        return $this->view->render($res, 'team.html', ['title' => 'Team ' . $team->team_number, 'team' => $team, 'events' => $events, 'numComments' => Comment::where('team_id', $team->team_number)->count(), 'comment' => Comment::where('team_id', $team->team_number)->first(), 'defenseExists' => $defense, 'defenses' => $defenses, 'pitScoutingData' => PitScouting::where('team_id', $team->team_number)->first(), 'author' => $author, 'comments' => $comments, 'user' => Auth::getLoggedInUser()]);
    });
});
Example #2
0
 $defense->portcullis = $_POST['portcullis'];
 $defense->cheval_de_frise = $_POST['cheval'];
 $defense->moat = $_POST['moat'];
 $defense->ramparts = $_POST['ramparts'];
 $defense->drawbridge = $_POST['drawbridge'];
 $defense->sally_port = $_POST['sallyport'];
 $defense->rock_wall = $_POST['rockwall'];
 $defense->rough_terrain = $_POST['roughterrain'];
 $defense->save();
 $comment = new Comment();
 $comment->user_id = Auth::getLoggedInUser()->id;
 $comment->author = Auth::getLoggedInUser()->name;
 $comment->team_id = $_POST['team_id'];
 $comment->notes = $_POST['notes'];
 $comment->save();
 $pit = new PitScouting();
 $pit->team_id = $_POST['team_id'];
 $pit->user_id = Auth::getLoggedInUser()->id;
 $pit->author = Auth::getLoggedInUser()->name;
 $pit->event_id = Utils::getCurrentEvent();
 $pit->num_boulders = $_POST['num_boulders'];
 $pit->boulders = $_POST['boulders'];
 $pit->hanging = $_POST['climbing'];
 $pit->sensors = $_POST['sensors'];
 $pit->defensive_play = $_POST['defensive_play'];
 $pit->approx_points = $_POST['approx_points'];
 $pit->approx_cycles = $_POST['approx_cycles'];
 $pit->autonomous_notes = $_POST['autonomous_notes'];
 $pit->num_drivers = $_POST['num_drivers'];
 $pit->drivetrain = $_POST['drivetrain'];
 $pit->defenses_id = $defense->id;
Example #3
-7
 public static function getUnscoutedTeams($event)
 {
     $teams = array();
     foreach (FileReader::getTeamsAtEvent($event) as $team) {
         if (!PitScouting::where(array('team_id' => $team->team_number, 'event_id' => $event))->first()) {
             array_push($teams, $team);
         }
     }
     return $teams;
 }