@cyc-seattle/platform 1.46.0 → 1.47.0
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.
|
@@ -38,9 +38,9 @@ export declare class Staffing {
|
|
|
38
38
|
private programs;
|
|
39
39
|
/**
|
|
40
40
|
* Warns when a block's sailors are more than its staff or its boats can safely take. Each program's
|
|
41
|
-
* sailors count against its own sailors per coach, and
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* sailors count against its own sailors per coach, and every coach on the block counts, at any
|
|
42
|
+
* staff level or salaried: the ratio is required, a coach's level isn't (cyc-seattle/sail-team#82).
|
|
43
|
+
* Boats count the ones sailors bring.
|
|
44
44
|
*/
|
|
45
45
|
private checkCapacity;
|
|
46
46
|
/**
|
|
@@ -130,9 +130,9 @@ export class Staffing {
|
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Warns when a block's sailors are more than its staff or its boats can safely take. Each program's
|
|
133
|
-
* sailors count against its own sailors per coach, and
|
|
134
|
-
*
|
|
135
|
-
*
|
|
133
|
+
* sailors count against its own sailors per coach, and every coach on the block counts, at any
|
|
134
|
+
* staff level or salaried: the ratio is required, a coach's level isn't (cyc-seattle/sail-team#82).
|
|
135
|
+
* Boats count the ones sailors bring.
|
|
136
136
|
*/
|
|
137
137
|
checkCapacity(block, programs) {
|
|
138
138
|
const { ctx } = this;
|
|
@@ -145,8 +145,8 @@ export class Staffing {
|
|
|
145
145
|
const scope = { version_id: block.row.version_id, date: block.row.date };
|
|
146
146
|
// The block's offerings, with the verb that agrees with them: "Guppies Week 2 has".
|
|
147
147
|
const has = `${offeringsOf(block)} ${new Set(block.members.map((a) => a.offering.id)).size > 1 ? "have" : "has"}`;
|
|
148
|
-
// Coaches
|
|
149
|
-
|
|
148
|
+
// Coaches the block needs: each program's sailors over its sailors per coach.
|
|
149
|
+
let load = 0;
|
|
150
150
|
let counted = 0;
|
|
151
151
|
for (const o of offerings) {
|
|
152
152
|
const settings = programs.get(o.product_id);
|
|
@@ -155,21 +155,11 @@ export class Staffing {
|
|
|
155
155
|
continue;
|
|
156
156
|
}
|
|
157
157
|
const n = ctx.enrollment.get(o.id) ?? 0;
|
|
158
|
-
|
|
158
|
+
load += n / settings.sailors_per_coach;
|
|
159
159
|
counted += n;
|
|
160
160
|
}
|
|
161
161
|
if (counted > 0) {
|
|
162
|
-
const
|
|
163
|
-
// Each level's staff cover only its own programs; salaried positions cover what's left.
|
|
164
|
-
let short = 0;
|
|
165
|
-
let covered = 0;
|
|
166
|
-
for (const [level, need] of needed) {
|
|
167
|
-
const have = sum(block.staff.filter((s) => s.position_key == null && s.staff_level_key === level).map((s) => s.count));
|
|
168
|
-
covered += Math.min(need, have);
|
|
169
|
-
short += Math.max(0, need - have);
|
|
170
|
-
}
|
|
171
|
-
const salaried = sum(block.staff.filter((s) => s.position_key != null).map((s) => s.count));
|
|
172
|
-
covered += Math.min(short, salaried);
|
|
162
|
+
const covered = Math.min(load, sum(block.staff.map((s) => s.count)));
|
|
173
163
|
if (load > covered + 1e-9) {
|
|
174
164
|
ctx.warn("over_capacity", covered === 0
|
|
175
165
|
? `${has} ${countOf(counted, "sailor")} and no coach`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyc-seattle/platform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"description": "Pulumi components for CYC's shared Google Cloud platform: WebService, the platform outputs reader, and the stacks that build the platform",
|
|
5
5
|
"author": "CYC Community Sailing Center",
|
|
6
6
|
"license": "Apache-2.0",
|