@dcrackel/hematournamentui 1.0.421 → 1.0.424

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31363,6 +31363,7 @@ const Cq = /* @__PURE__ */ ie(ZT, [["render", s4]]), a4 = "data:image/png;base64
31363
31363
  ]
31364
31364
  };
31365
31365
  },
31366
+ emits: ["button:Account", "button:Logout", "button:Click"],
31366
31367
  mounted() {
31367
31368
  document.addEventListener("click", this.handleClickOutside);
31368
31369
  },
@@ -32889,7 +32890,7 @@ function Q7(n, e, t, r, o, i) {
32889
32890
  directorName: i.getDirectorName(d.Staff),
32890
32891
  pool: d.participants,
32891
32892
  staff: t.staff,
32892
- mode: t.event.Status,
32893
+ mode: t.event.Status || "planning",
32893
32894
  loading: t.loading,
32894
32895
  "onUpdate:swapFencers": i.swapFencers,
32895
32896
  "onUpdate:setDirector": i.setDirector,
@@ -35715,12 +35716,6 @@ const _p = /* @__PURE__ */ ie(lL, [["render", QL]]), vL = {
35715
35716
  };
35716
35717
  },
35717
35718
  watch: {
35718
- numPromoted() {
35719
- this.updatePromotions();
35720
- },
35721
- poolResults(n) {
35722
- this.results = n, this.updatePromotions();
35723
- },
35724
35719
  initialCutoffIndex(n) {
35725
35720
  this.cutoffIndex = n - 1, this.updatePromotions();
35726
35721
  }
@@ -35730,6 +35725,9 @@ const _p = /* @__PURE__ */ ie(lL, [["render", QL]]), vL = {
35730
35725
  return this.event.Status && ["live", "results", "de", "completed"].includes(this.event.Status.toLowerCase());
35731
35726
  }
35732
35727
  },
35728
+ mounted() {
35729
+ this.updatePromotions();
35730
+ },
35733
35731
  methods: {
35734
35732
  moveUp() {
35735
35733
  this.cutoffIndex > 1 && (this.cutoffIndex--, this.updatePromotions(), this.$emit("update:handleDecreaseCount", this.numPromoted));
@@ -35845,10 +35843,6 @@ const TL = /* @__PURE__ */ ie(vL, [["render", OL]]), RL = {
35845
35843
  type: Object,
35846
35844
  required: !0
35847
35845
  },
35848
- rules: {
35849
- type: Object,
35850
- required: !0
35851
- },
35852
35846
  poolResults: {
35853
35847
  type: Array,
35854
35848
  required: !0
@@ -35884,6 +35878,10 @@ const TL = /* @__PURE__ */ ie(vL, [["render", OL]]), RL = {
35884
35878
  }
35885
35879
  },
35886
35880
  computed: {
35881
+ rules() {
35882
+ var n;
35883
+ return ((n = this.event) == null ? void 0 : n.eventRules) || [];
35884
+ },
35887
35885
  promotedByRule() {
35888
35886
  var e;
35889
35887
  const n = (e = this.rules) == null ? void 0 : e.find((t) => t.Rules.RuleName === "DEPromoteBy");
@@ -35903,7 +35901,7 @@ const TL = /* @__PURE__ */ ie(vL, [["render", OL]]), RL = {
35903
35901
  let e = this.getNumericValue(n);
35904
35902
  if (this.promotedByRule === "Top") {
35905
35903
  const t = this.rules.find((r) => r.Rules.RuleName === "DENumOfPromotion");
35906
- t && (t.RuleValue++, console.log(t.RuleValue));
35904
+ t && (t.RuleValue++, console.log(t.RuleValue), this.updatePromotions());
35907
35905
  return;
35908
35906
  }
35909
35907
  if (e === 100) {
@@ -35916,7 +35914,7 @@ const TL = /* @__PURE__ */ ie(vL, [["render", OL]]), RL = {
35916
35914
  let e = this.getNumericValue(n);
35917
35915
  if (this.promotedByRule === "Top") {
35918
35916
  const t = this.rules.find((r) => r.Rules.RuleName === "DENumOfPromotion");
35919
- t && (t.RuleValue--, console.log(t.RuleValue));
35917
+ t && (t.RuleValue--, console.log(t.RuleValue), this.updatePromotions());
35920
35918
  return;
35921
35919
  }
35922
35920
  this.poolResults.filter((t) => t.Promoted).length < 5 || this.calculateInitialCutoffIndex(e - 10);
@@ -35926,8 +35924,33 @@ const TL = /* @__PURE__ */ ie(vL, [["render", OL]]), RL = {
35926
35924
  return typeof n == "string" && (e = parseInt(n.replace("%", ""))), typeof n == "number" && (e = n), e;
35927
35925
  },
35928
35926
  calculateInitialCutoffIndex(n) {
35927
+ if (this.promotedByRule === "Top") {
35928
+ const r = parseInt(this.promoted, 10) || 2;
35929
+ this.updatePromotions(r);
35930
+ return;
35931
+ }
35929
35932
  const e = this.poolResults.length, t = n / 100;
35930
- this.promoted = `${n}%`, this.initialCutoffIndex = Math.ceil(e * t);
35933
+ this.promoted = `${n}%`, this.initialCutoffIndex = Math.ceil(e * t), this.updatePromotions(this.initialCutoffIndex);
35934
+ },
35935
+ updatePromotions(n = parseInt(this.promoted, 10) || 2) {
35936
+ const e = this.groupFencersByPool(this.poolResults);
35937
+ Object.entries(e).forEach(([t]) => {
35938
+ this.sortFencersByCriteria(t), this.markTopFencers(t, n);
35939
+ }), console.log("Final Pool Results After Promotion:", this.poolResults);
35940
+ },
35941
+ groupFencersByPool(n) {
35942
+ return n.reduce((e, t) => {
35943
+ const r = t.PoolId || t.PoolName;
35944
+ return e[r] || (e[r] = []), e[r].push(t), e;
35945
+ }, {});
35946
+ },
35947
+ sortFencersByCriteria(n) {
35948
+ return Array.isArray(n) ? [...n].sort((e, t) => t.WinPercentage !== e.WinPercentage ? t.WinPercentage - e.WinPercentage : t.TotalWins !== e.TotalWins ? t.TotalWins - e.TotalWins : t.Indicator !== e.Indicator ? t.Indicator - e.Indicator : t.PointsScored - e.PointsScored) : (console.error("Invalid input to sortFencersByCriteria:", n), null);
35949
+ },
35950
+ markTopFencers(n, e) {
35951
+ n.forEach((t, r) => {
35952
+ t.Promoted = r < e;
35953
+ });
35931
35954
  },
35932
35955
  closeModal() {
35933
35956
  this.showRemoveModal = !1, this.withdrawPerson = {};