Skip to content

Commit

Permalink
feat(cups): sorry, barryp event multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
sunehs committed Jan 2, 2025
1 parent 845177d commit 645f1e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/data/models/SiteCup.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const SiteCup = Model.define(
allowNull: true,
defaultValue: null,
},
Double: {
Multiplier: {
type: DataType.INTEGER,
allowNull: false,
defaultValue: 0,
Expand Down
8 changes: 4 additions & 4 deletions src/utils/cups.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const pointsSystem2 = [
17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
];

const getPoints = (pos, pointSystem, double) => {
const multiplier = double ? 2 : 1;
const getPoints = (pos, pointSystem, eventMultiplier) => {
const multiplier = eventMultiplier ? eventMultiplier : 1;
let pts = points;
if (pointSystem === 1) {
pts = pointsSystem2;
Expand Down Expand Up @@ -90,7 +90,7 @@ export const filterResults = (events, ownerId = [], loggedId = 0, cupGroup) => {
combinedPoints += getPoints(
drawPos,
cupGroup?.PointSystem,
event.Double,
event.Multiplier,
);
}
const drawPoints = combinedPoints / draws.length;
Expand All @@ -101,7 +101,7 @@ export const filterResults = (events, ownerId = [], loggedId = 0, cupGroup) => {
filteredResults[pos].Points = getPoints(
pos,
cupGroup?.PointSystem,
event.Double,
event.Multiplier,
);
filteredResults[pos].Position = pos + 1;
}
Expand Down

0 comments on commit 645f1e7

Please sign in to comment.