Пример #1
0
 /**
  * @test
  */
 public function generatesSeasonalRegistrationDescription()
 {
     foreach (Program::all() as $program) {
         $item = new Item(['sku' => $program->sku]);
         $this->assertEquals($program->name . ' Seasonal Registration', $item->name());
     }
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Season::create(['name' => date('Y') . '-' . (date('y') + 1)]);
     Program::create(['name' => 'Beginner Bible Bowl', 'abbreviation' => 'Beginner', 'slug' => 'beginner', 'registration_fee' => '25.00', 'min_grade' => 2, 'max_grade' => 5]);
     Program::create(['name' => 'Teen Bible Bowl', 'abbreviation' => 'Teen', 'slug' => 'teen', 'registration_fee' => '35.00', 'min_grade' => 6, 'max_grade' => 12]);
     GroupType::create(['name' => 'Christian School']);
     GroupType::create(['name' => 'Homeschool']);
     GroupType::create(['name' => 'Church']);
     GroupType::create(['name' => 'Other']);
     ParticipantType::create(['name' => 'Team']);
     ParticipantType::create(['name' => 'Player']);
     ParticipantType::create(['name' => 'Quizmaster']);
     ParticipantType::create(['name' => 'Spectator - Adult', 'description' => 'Single adult']);
     ParticipantType::create(['name' => 'Spectator - Family', 'description' => 'Up to 2 adults and children who are not players']);
     EventType::create(['participant_type_id' => ParticipantType::TEAM, 'name' => 'Round Robin']);
     EventType::create(['participant_type_id' => ParticipantType::PLAYER, 'name' => 'Quote Bee']);
     EventType::create(['participant_type_id' => ParticipantType::TEAM, 'name' => 'Double Elimination']);
     EventType::create(['participant_type_id' => ParticipantType::PLAYER, 'name' => 'BuzzOff']);
     EventType::create(['participant_type_id' => ParticipantType::PLAYER, 'name' => 'King of the Hill']);
     Bouncer::allow(Role::ADMIN)->to([Ability::VIEW_REPORTS, Ability::MANAGE_ROLES, Ability::MANAGE_USERS, Ability::MANAGE_GROUPS, Ability::MANAGE_PLAYERS, Ability::CREATE_TOURNAMENTS, Ability::SWITCH_ACCOUNTS, Ability::MANAGE_SETTINGS]);
     Bouncer::allow(Role::BOARD_MEMBER)->to(Ability::VIEW_REPORTS);
     Bouncer::allow(Role::HEAD_COACH)->to([Ability::MANAGE_ROSTER, Ability::MANAGE_TEAMS]);
     Role::create(['name' => Role::COACH, 'mailchimp_interest_id' => '29a52dd6fc']);
     Role::create(['name' => Role::LEAGUE_COORDINATOR, 'mailchimp_interest_id' => '9b90dc8bdd']);
     Role::create(['name' => Role::QUIZMASTER, 'mailchimp_interest_id' => 'fe3a183033']);
     Bouncer::allow(Role::QUIZMASTER);
     Bouncer::allow(Role::GUARDIAN)->to(Ability::REGISTER_PLAYERS);
     Role::where('name', Role::HEAD_COACH)->update(['mailchimp_interest_id' => 'be4c459134']);
     Role::where('name', Role::GUARDIAN)->update(['mailchimp_interest_id' => '0f83e0f312']);
     $howDidYouHearAbout = RegistrationSurveyQuestion::create(['question' => 'How did you hear about Bible Bowl?', 'order' => 1]);
     $howDidYouHearAbout->answers()->saveMany([app(RegistrationSurveyAnswer::class, [['answer' => 'Friend', 'order' => '1']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Church brochure/bulletin', 'order' => '2']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Homeschool convention', 'order' => '3']]), app(RegistrationSurveyAnswer::class, [['answer' => 'TV', 'order' => '4']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Web Advertisement', 'order' => '5']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Internet', 'order' => '6']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Other', 'order' => '7']])]);
     $mostInfluential = RegistrationSurveyQuestion::create(['question' => 'Which of the following were most influential in your decision to join Bible Bowl?', 'order' => 2]);
     $mostInfluential->answers()->saveMany([app(RegistrationSurveyAnswer::class, [['answer' => "Friend's recommendation", 'order' => '1']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Attending a practice/demo/meeting', 'order' => '2']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Learning about it on the web site', 'order' => '3']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Homeschool curriculum potential', 'order' => '4']]), app(RegistrationSurveyAnswer::class, [['answer' => 'Other', 'order' => '5']])]);
 }
Пример #3
0
 /**
  * @return \Illuminate\View\View
  */
 public function create()
 {
     $programs = [];
     foreach (Program::all() as $program) {
         $programs[$program->id] = $program . '';
     }
     return view('group.create')->withPrograms($programs);
 }
Пример #4
0
 /**
  * @return \Illuminate\View\View
  */
 public function create()
 {
     $programs = [];
     foreach (Program::all() as $program) {
         $programs[$program->id] = $program . '';
     }
     return view('tournaments.admin.create', ['programs' => $programs, 'eventTypes' => EventType::orderBy('name', 'ASC')->get(), 'participantTypes' => ParticipantType::orderBy('name', 'ASC')->get(), 'defaultEventTypes' => [EventType::ROUND_ROBIN, EventType::DOUBLE_ELIMINATION]]);
 }
Пример #5
0
 /**
  * @test
  */
 public function sixthGradersCanBeAddedToBeginnerOrTeen()
 {
     GroupRegistration::$gradesWithProgramChoice = [6];
     $this->visit('/register/players')->see('David Webb')->select('6', 'player[1][grade]')->press('Continue')->seePageIs('/register/program')->see('David Webb')->select(Program::BEGINNER, 'player[1]')->press('Continue');
     // assert the player is classified as beginner
     $beginner = Program::findOrFail(Program::BEGINNER);
     /** @var GroupRegistration $registration */
     $registration = Session::seasonalGroupRegistration();
     $this->arrayHasKey(1, $registration->playerInfo($beginner));
 }
Пример #6
0
 private function seedReceipts()
 {
     $teen = Program::findOrFail(Program::TEEN);
     $receipt = Receipt::create(['total' => $teen->registration_fee * 3, 'payment_reference_number' => uniqid(), 'user_id' => DatabaseSeeder::$guardian->id, 'address_id' => DatabaseSeeder::$guardian->primary_address_id]);
     $receipt->items()->create(['sku' => $teen->sku, 'description' => $teen->name . ' Seasonal Registration', 'quantity' => '3', 'price' => $teen->registration_fee]);
     $createdAt = Carbon::now()->subMonth();
     $beginner = Program::findOrFail(Program::BEGINNER);
     $receipt = Receipt::create(['total' => $beginner->registration_fee * 3, 'payment_reference_number' => uniqid(), 'user_id' => DatabaseSeeder::$guardian->id, 'address_id' => DatabaseSeeder::$guardian->primary_address_id, 'created_at' => $createdAt]);
     $receipt->items()->create(['sku' => $beginner->sku, 'description' => $beginner->name . ' Seasonal Registration', 'quantity' => '3', 'price' => $beginner->registration_fee, 'created_at' => $createdAt]);
 }
Пример #7
0
 /**
  * @param SettingsUpdateRequest $request
  *
  * @return mixed
  */
 public function update(SettingsUpdateRequest $request)
 {
     DB::transaction(function () use($request) {
         Setting::setSeasonEnd(Carbon::createFromTimestamp(strtotime($request->get('season_end'))));
         Setting::save();
         // update programs
         foreach ($request->get('program') as $programId => $toUpdate) {
             Program::where('id', $programId)->update($toUpdate);
         }
     });
     return redirect('/admin/settings/')->withFlashSuccess('Your changes were saved');
 }
Пример #8
0
 /**
  * @return Program
  */
 public function programs()
 {
     if ($this->programs == null) {
         $programs = [];
         foreach (Program::all() as $program) {
             if ($this->numberOfPlayers($program) > 0) {
                 $programs[] = $program;
             }
         }
         $this->programs = $programs;
     }
     return $this->programs;
 }
Пример #9
0
 /**
  * Build a user friendly display name based
  * on the SKU.
  *
  * @return string
  */
 public function name()
 {
     // seasonal registrations
     $seasonalGroupRegistrationPrefix = 'SEASON_REG_';
     if (starts_with($this->sku, $seasonalGroupRegistrationPrefix)) {
         $program = Program::where('slug', str_replace($seasonalGroupRegistrationPrefix, '', $this->sku))->firstOrFail();
         return $program->name . ' Seasonal Registration';
     }
     // tournament registrations
     $tournamentRegistrationPrefix = 'TOURNAMENT_REG_';
     if (starts_with($this->sku, $tournamentRegistrationPrefix)) {
         $pieces = explode('_', $this->sku);
         unset($pieces[0]);
         unset($pieces[1]);
         return ucwords(strtolower(implode(' ', $pieces))) . ' Tournament Registration';
     }
     return $this->sku;
 }
Пример #10
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(AutomatedGroupDeactivator $groupDeactivator)
 {
     /** @var Carbon $endDate */
     $endDate = Setting::seasonEnd();
     /** @var Carbon $startDate */
     $startDate = Setting::seasonStart();
     $nextSeasonName = $startDate->format('Y-') . $startDate->addYear()->format('y');
     // notify the office before the season rotates
     $rotateInDays = 7;
     if ($endDate->isBirthday(Carbon::now()->addDays($rotateInDays))) {
         Mail::queue('emails.season-rotate-notification', ['willRotateOn' => $endDate->toFormattedDateString(), 'nextSeasonName' => $nextSeasonName, 'programs' => Program::orderBy('name', 'ASC')->get()], function (Message $message) use($nextSeasonName, $rotateInDays) {
             $message->to(config('biblebowl.officeEmail'))->subject('The ' . $nextSeasonName . ' season begins in ' . $rotateInDays . ' days');
         });
     }
     // rotate the season
     if ($endDate->isBirthday()) {
         /* @var Season $season */
         Season::firstOrCreate(['name' => $nextSeasonName]);
         // since the season rotated today, deactivate inactive groups from last season
         $lastSeason = Season::orderBy('id', 'DESC')->skip(1)->first();
         $groupDeactivator->deactivateInactiveGroups($lastSeason);
     }
 }
Пример #11
0
 private function seedReceipt(User $user) : Receipt
 {
     $program = Program::firstOrFail();
     $receipt = Receipt::create(['total' => 15.0, 'payment_reference_number' => uniqid(), 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'user_id' => $user->id, 'address_id' => $user->primary_address_id]);
     $receipt->items()->create(['sku' => $program->sku, 'description' => $program->name . ' Seasonal Registration', 'quantity' => '2', 'price' => $program->registration_fee]);
     return $receipt;
 }
@extends('emails.simple')

@section('body')
    <?php 
// Serialized objects need to be re-instantiated in order
// to have a successful database connection
$programs = \BibleBowl\Program::orderBy('name', 'ASC')->get();
?>

    @include('emails.theme.header', [
        'header' => 'Automatically Deactivated Groups'
    ])

    @include('emails.theme.text-block', [
        'body' => '<p>Groups automatically become inactive when they end a season without any active players.  This time, <strong>'.count($groupIds).'</strong> met the criteria.  They have already been notified as well as provided instructions on how to reactivate their group or transfer the group ownership to another individual.  There\'s nothing you need to do, this is merely a notification that the following groups are now inactive.</p>'
    ])

    @foreach($programs as $program)
        <?php 
$groups = \BibleBowl\Group::whereIn('id', $groupIds)->where('program_id', $program->id)->with('owner')->get();
?>
        @if($groups->count() > 0)
            <?php 
$bulletedList = '';
foreach ($groups as $group) {
    $bulletedList .= '<li>' . $group->name . ' (' . $group->owner->full_name . ')</li>';
}
?>
            @include('emails.theme.text-block', [
                'body' => "<h4>".$program->name."</h4><ul>".$bulletedList.'</ul>'
            ])
Пример #13
0
 /**
  * Query groups by beginner or teen.
  */
 public function scopeByProgram(Builder $query, $program)
 {
     if (is_string($program)) {
         $program = Program::where('slug', $program)->first()->id;
     }
     return $query->where('groups.program_id', $program);
 }
 /**
  * If the group isn't found this step will direct
  * the parent to a later.
  */
 public function later($programSlug)
 {
     /** @var GroupRegistration $registration */
     $registration = Session::seasonalGroupRegistration();
     $playersRemovedFromProgram = null;
     $continueRegistration = false;
     foreach (Program::all() as $program) {
         // don't register players in this program
         if ($program->slug == $programSlug && $registration->numberOfPlayers($program) > 0) {
             $registration->removePlayers($program);
             $playersRemovedFromProgram = $program;
         }
         // only continue if other programs have players
         if ($registration->numberOfPlayers($program) > 0) {
             $continueRegistration = true;
         }
     }
     Session::setSeasonalGroupRegistration($registration);
     if ($continueRegistration) {
         return redirect('/register/summary')->withFlashSuccess('Your ' . $playersRemovedFromProgram->abbreviation . ' players have been removed from this registration');
     }
     return redirect('/dashboard');
 }