Skip to content

Commit 6d3b172

Browse files
committed
student pay: min RAM = 2 GB
1 parent f904ff1 commit 6d3b172

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/packages/frontend/course/configuration/student-pay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import dayjs from "dayjs";
1212
import { isEqual } from "lodash";
1313
import { useEffect, useMemo, useState } from "react";
1414
import { FormattedMessage, useIntl } from "react-intl";
15-
1615
import { Gap, Icon, TimeAgo } from "@cocalc/frontend/components";
1716
import { labels } from "@cocalc/frontend/i18n";
1817
import LicenseEditor from "@cocalc/frontend/purchases/license-editor";
@@ -227,6 +226,7 @@ export default function StudentPay({ actions, settings }) {
227226
onChange={setInfo}
228227
hiddenFields={new Set(["quantity", "custom_member"])}
229228
minDiskGb={1}
229+
minRamGb={2}
230230
/>
231231
<div style={{ margin: "15px 0" }}>
232232
<StudentPayCheckboxLabel

src/packages/frontend/purchases/license-editor.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ interface Props {
4040
hiddenFields?: Set<Field>;
4141
noCancel?: boolean;
4242
minDiskGb?: number;
43+
minRamGb?: number;
4344
}
4445

4546
const END_PRESETS: {
@@ -66,6 +67,7 @@ export default function LicenseEditor({
6667
cellStyle,
6768
noCancel,
6869
minDiskGb = MIN_DISK_GB,
70+
minRamGb = 4,
6971
}: Props) {
7072
if (info.type == "vouchers") {
7173
return <Alert type="error" message="Editing vouchers is not allowed." />;
@@ -206,7 +208,7 @@ export default function LicenseEditor({
206208
value: (
207209
<InputNumber
208210
disabled={disabledFields?.has("custom_ram")}
209-
min={1}
211+
min={minRamGb}
210212
max={MAX.ram}
211213
step={1}
212214
value={info.custom_ram}

src/packages/util/licenses/purchase/consts.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
import { CustomUpgrades, Subscription, User } from "./types";
7-
87
import costVersions from "./cost-versions";
98

109
export const CURRENT_VERSION = "3";
@@ -82,10 +81,6 @@ interface CostsStructure {
8281
}
8382

8483
export function getCosts(version: string): CostsStructure {
85-
const x = costVersions[version];
86-
if (x == null) {
87-
throw Error(`Unknown cost version '${version}'`);
88-
}
8984
const {
9085
SUB_DISCOUNT,
9186
GCE_COSTS,
@@ -96,7 +91,7 @@ export function getCosts(version: string): CostsStructure {
9691
RAM_OVERCOMMIT,
9792
CPU_OVERCOMMIT,
9893
ALWAYS_RUNNING_FACTOR,
99-
} = costVersions[version];
94+
} = costVersions[version] ?? costVersions[CURRENT_VERSION];
10095

10196
const CUSTOM_COST: CostMap = {
10297
ram:

0 commit comments

Comments
 (0)