Skip to content

Commit

Permalink
Merge pull request #497 from frank-weinberg/feature/copy-lineups
Browse files Browse the repository at this point in the history
Add possibility to copy lineups from prior jam
  • Loading branch information
frank-weinberg authored Dec 30, 2021
2 parents 470e866 + 1dbbb7f commit cc38e31
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m"
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx8G -Xms100m"
}
2 changes: 2 additions & 0 deletions html/components/lt-sheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ div.LT { font-size: 200%; text-align: center; background-color: #cccccc; color:
.LT.Period.Forwards tr.SP td { border-top-style: dotted; }
.LT.Period tbody .Box { background-color: #b6daff; }
.LT.Period .JamNumber { width: 30px; }
.LT.Period .CopyArrow { position: relative; }
.LT.Period .CopyArrow::before { position: absolute; left: 0px; content: "⮬";color: #777; }
.LT.Period .NP { width: 25px; }
.LT.Period .Skater { width: 12%; }
.LT.Period .Box { width: 8%; }
Expand Down
11 changes: 9 additions & 2 deletions html/components/lt-sheet.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion html/components/plt-input.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ body:not(.AllowSelect) .PLT {user-select: none;-webkit-user-select: none;-khtml-
.PLT.Team .Advance.Active { border: none; background-color: #ff9010; vertical-align: bottom; }
.PLT.Team tr:nth-child(6n+1) .Advance.Active::after { content: "Go To"; }
.PLT.Team tr:nth-child(6n+3) .Advance.Active::after { content: "Next Jam"; }
.PLT.Team .Advance:not(.Active).OnTrack::after { content: "..."; }
.PLT.Team .Advance:not(.Active).OnTrack::after { content: ""; }

#PenaltyEditor .Codes>div { float: left; width: 150px; height: 90px; margin: 10px; border: 1px solid black; font-weight: bold; }
#PenaltyEditor .Codes>div.Active { background-color: #F00; color: #FFF; }
Expand Down
2 changes: 1 addition & 1 deletion html/components/sk-sheet.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions html/components/teams-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ function createEditTeamTable(element, teamPrefix, changable) {
// Team update.
switch (k.field) {
case 'Logo':
v = v || '';
logoSelect.val(v.substring(v.lastIndexOf('/') + 1));
break;
case 'AlternateName':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import com.carolinarollergirls.scoreboard.core.interfaces.Game;
import com.carolinarollergirls.scoreboard.core.interfaces.Jam;
import com.carolinarollergirls.scoreboard.core.interfaces.Position;
import com.carolinarollergirls.scoreboard.core.interfaces.Role;
import com.carolinarollergirls.scoreboard.core.interfaces.ScoringTrip;
import com.carolinarollergirls.scoreboard.core.interfaces.Skater;
import com.carolinarollergirls.scoreboard.core.interfaces.Team;
import com.carolinarollergirls.scoreboard.core.interfaces.TeamJam;
import com.carolinarollergirls.scoreboard.event.Child;
import com.carolinarollergirls.scoreboard.event.Command;
import com.carolinarollergirls.scoreboard.event.ParentOrderedScoreBoardEventProviderImpl;
import com.carolinarollergirls.scoreboard.event.RecalculateScoreBoardListener;
import com.carolinarollergirls.scoreboard.event.ScoreBoardEventProvider;
Expand All @@ -20,7 +23,7 @@ public TeamJamImpl(Jam j, String teamId) {
super(j, teamId, Jam.TEAM_JAM);
addProperties(CURRENT_TRIP, CURRENT_TRIP_NUMBER, LAST_SCORE, OS_OFFSET, OS_OFFSET_REASON, JAM_SCORE,
AFTER_S_P_SCORE, TOTAL_SCORE, LOST, LEAD, CALLOFF, INJURY, NO_INITIAL, DISPLAY_LEAD, STAR_PASS,
STAR_PASS_TRIP, NO_PIVOT, FIELDING, SCORING_TRIP);
STAR_PASS_TRIP, NO_PIVOT, FIELDING, SCORING_TRIP, COPY_LINEUP_TO_CURRENT);
game = j.getPeriod().getGame();
team = game.getTeam(teamId);
setRecalculated(CURRENT_TRIP).addSource(this, SCORING_TRIP);
Expand Down Expand Up @@ -126,6 +129,34 @@ public ScoreBoardEventProvider create(Child<?> prop, String id, Source source) {
}
}

@Override
public void execute(Command prop, Source source) {
if (prop == COPY_LINEUP_TO_CURRENT) { copyLineupToCurrentJam(); }
}

private void copyLineupToCurrentJam() {
if (isRunningOrUpcoming()) { return; }

TeamJam current = team.getRunningOrUpcomingTeamJam();

for (FloorPosition fp : FloorPosition.values()) { copySkaterToIfAvailable(fp, current); }
}

private void copySkaterToIfAvailable(FloorPosition fp, TeamJam target) {
Skater s = getFielding(fp).getSkater();
if (s == null || s.getFielding(target) != null) { return; }

boolean placeAvailable = target.getFielding(fp).getSkater() == null;
if (fp.getRole() == Role.BLOCKER) {
placeAvailable = target.getFielding(FloorPosition.BLOCKER1).getSkater() == null ||
target.getFielding(FloorPosition.BLOCKER2).getSkater() == null ||
target.getFielding(FloorPosition.BLOCKER3).getSkater() == null ||
target.getFielding(FloorPosition.PIVOT).getSkater() == null;
}

if (placeAvailable) { team.field(s, fp.getRole(), target); }
}

@Override
public Jam getJam() {
return (Jam) parent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.carolinarollergirls.scoreboard.core.interfaces;

import com.carolinarollergirls.scoreboard.event.Child;
import com.carolinarollergirls.scoreboard.event.Command;
import com.carolinarollergirls.scoreboard.event.NumberedChild;
import com.carolinarollergirls.scoreboard.event.ParentOrderedScoreBoardEventProvider;
import com.carolinarollergirls.scoreboard.event.Value;
Expand Down Expand Up @@ -63,4 +64,6 @@ public interface TeamJam extends ParentOrderedScoreBoardEventProvider<TeamJam> {
Child<Fielding> FIELDING = new Child<>(Fielding.class, "Fielding");

NumberedChild<ScoringTrip> SCORING_TRIP = new NumberedChild<>(ScoringTrip.class, "ScoringTrip");

Command COPY_LINEUP_TO_CURRENT = new Command("CopyLineupToCurrent");
}

0 comments on commit cc38e31

Please sign in to comment.