Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { FormationMap, SchemeData } from "../Constants/GameplanConstants";
import {
Formation,
FormationMap,
SchemeData,
} from "../Constants/GameplanConstants";

export interface GameplanData {
ID: number;
Expand Down Expand Up @@ -628,7 +632,10 @@ export const stringifyFocusPlays = (focusPlays: string[]): string => {
return focusPlays.join(",");
};

export const transformGameplanForSave = (gameplan: GameplanData): any => {
export const transformGameplanForSave = (
gameplan: GameplanData,
offensiveFormations: Formation[]
): any => {
const transformed = { ...gameplan };
const offForm1Weight =
transformed.OffForm1TraditionalRun +
Expand Down Expand Up @@ -662,6 +669,11 @@ export const transformGameplanForSave = (gameplan: GameplanData): any => {
OffForm3Weight: offForm3Weight,
OffForm4Weight: offForm4Weight,
OffForm5Weight: offForm5Weight,
OffFormation1Name: offensiveFormations[0].name,
OffFormation2Name: offensiveFormations[1].name,
OffFormation3Name: offensiveFormations[2].name,
OffFormation4Name: offensiveFormations[3].name,
OffFormation5Name: offensiveFormations[4].name,
};

if (typeof transformed.LeftVsRight === "number") {
Expand Down
Loading