Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nicer display of Host Control Panel, internal fixes #853

Merged
merged 16 commits into from
Nov 21, 2024
Merged

Conversation

bakert
Copy link
Member

@bakert bakert commented Nov 21, 2024

  • Switch to river-style SQL in Deck constructor
  • Tighten up nullability on Deck
  • Remove some error checking we have typesafed out of existence
  • Remove a test that has been typesafed away
  • Update phpstan baseline after recent improvements
  • Update psalm baseline after fixing some props in Deck constructor
  • Componentize MonthDropMenu
  • Componentize EntryListItem
  • Componentize UnverifiedPlayerCell
  • Stop confusing the typechecker with too-specific types
  • Accomodate events that don't have any final rounds
  • *Remove all remaining Args funcs that return arrays in favor of Components
  • Return assoc array when returning more than one var
  • Remove a couple rogue colors in favor of vars
  • Types for medallists
  • Split event display into Pending, Active, Upcoming and Past Events

Used in the list of registered players on event.php. This was one of the first
things converted to the Page system and I later decided on a more componentized
and less "pass horking great big objects into mustache templates" style.
Set the medals correctly and don't error upon event conclusion if, say, you only
have 4 rounds Single Elimination as mainrounds with no finalrounds.

This used to work in the old code but I didn't quite translate it right when
refactoring:

```
// Assigns trophies based on the finals matches which are entered.
    public function assignTropiesFromMatches()
    {
        $t8 = [];
        $t4 = [];
        $sec = '';
        $win = '';
        if ($this->finalrounds > 0) {
            $quarter_finals = $this->finalrounds >= 3;
            if ($quarter_finals) {
                $quart_round = $this->mainrounds + $this->finalrounds - 2;
                $matches = $this->getRoundMatches($quart_round);
                foreach ($matches as $match) {
                    $t8[] = $match->getLoser();
                }
            }
            $semi_finals = $this->finalrounds >= 2;
            if ($semi_finals) {
                $semi_round = $this->mainrounds + $this->finalrounds - 1;
                $matches = $this->getRoundMatches($semi_round);
                foreach ($matches as $match) {
                    $t4[] = $match->getLoser();
                }
            }

            $finalmatches = $this->getRoundMatches($this->mainrounds + $this->finalrounds);
            $finalmatch = $finalmatches[0];
            $sec = $finalmatch->getLoser();
            $win = $finalmatch->getWinner();
        } else {
            $quarter_finals = $this->mainrounds >= 3;
            if ($quarter_finals) {
                $quart_round = $this->mainrounds - 2;
                $matches = $this->getRoundMatches($quart_round);
                foreach ($matches as $match) {
                    $t8[] = $match->getLoser();
                }
            }
            $semi_finals = $this->mainrounds >= 2;
            if ($semi_finals) {
                $semi_round = $this->mainrounds - 1;
                $matches = $this->getRoundMatches($semi_round);
                foreach ($matches as $match) {
                    $t4[] = $match->getLoser();
                }
            }

            $finalmatches = $this->getRoundMatches($this->mainrounds);
            $finalmatch = $finalmatches[0];
            $sec = $finalmatch->getLoser();
            $win = $finalmatch->getWinner();
        }
        $this->setFinalists($win, $sec, $t4, $t8);
    }
```
That's what we do elsewhere so let's stay consistent. This is more self-
describing if a bit more verbose.
Events that need to be started are most important, event that are running are
next most important, events in the future are next, and old events are least;
now the hierarchy of the page reflects that.

Remove a bunch of not-super-useful columns from event display. This'll work
better on mobile and "k value" and "host/cohost" were not super useful columns.
"Finalized" is now implied by location on the page and can go too.
@bakert bakert merged commit 24730d5 into dev Nov 21, 2024
4 checks passed
@bakert bakert deleted the deck-nullables branch November 21, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant