Skip to content

Commit

Permalink
Merge pull request #612 from celestemods-com/main
Browse files Browse the repository at this point in the history
Update Prod
  • Loading branch information
otobot1 authored Oct 28, 2023
2 parents efb87e4 + 73cd518 commit cfae811
Show file tree
Hide file tree
Showing 4 changed files with 345 additions and 158 deletions.
15 changes: 10 additions & 5 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const seedRandomData = async () => {
for (let i = 1; i <= 5; i++) {
const difficulty = await prisma.difficulty.create({
data: {
name: "ExampleParentDifficulty" + i,
name: "Difficulty" + i,
description: "Example parent difficulty " + i,
parentDifficultyId: 0,
order: i,
Expand All @@ -27,7 +27,7 @@ const seedRandomData = async () => {
childDifficulties.push(
await prisma.difficulty.create({
data: {
name: `ExampleChildDifficulty${i}-${j}`,
name: `Difficulty${i}: ChildDifficulty${j}`,
description: `Example child difficulty ${i}-${j}`,
parentDifficultyId: difficulty.id,
order: j,
Expand Down Expand Up @@ -151,8 +151,13 @@ const seedRandomData = async () => {

const maps = [];

for (let i = 0; i < 30; i++) {
const mod = randomElement(mods);
for (let i = 0; i < mods.length + 50; i++) {
// We assign at least one map to each mod, and another 50 maps to random mods.
let mod = mods.at(i);
if (!mod) {
mod = randomElement(mods);
}

const timeSubmitted = randomInteger(mod.timeApproved, mod.timeApproved + 10000000);
const timeApproved = randomInteger(timeSubmitted, timeSubmitted + 1000000);

Expand All @@ -165,7 +170,7 @@ const seedRandomData = async () => {
timeSubmitted,
timeApproved,
canonicalDifficultyId: randomElement(parentDifficulties).id,
modId: randomElement(mods).id,
modId: mod.id,
lengthId: randomElement(lengths).id,
}
})
Expand Down
Loading

0 comments on commit cfae811

Please sign in to comment.