-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* migrate and add answer type * Set placeholders and remove default * Design changes (see commit history for more details) (#94) * Prganize imports * Better letter spacing and center task titles * More space in achievements * More spacing between entries * Change graph interval back to every fifth minute * Add sign in/out to footer * Informative front page * Add home-button and a bit smaller spacing between * Finish placeholders * refetch streaks when you fail * Testing tasks (#97) * Update regEx to fit more task variants * Update seeds to focus on actual data. Begin adding real tasks --------- Co-authored-by: kharann <[email protected]>
- Loading branch information
1 parent
8b74ed2
commit 63bb518
Showing
24 changed files
with
277 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { differenceInSeconds } from "date-fns"; | ||
import { prismaClient } from "./clients"; | ||
import { initBlussuvoll } from "./prod"; | ||
import { createNoobTasks } from "./prod/noobs"; | ||
|
||
async function init() { | ||
const timer = new Date(); | ||
console.info("--- --- --- --- --- --- ---"); | ||
console.info("🌱 Seeding database for production!"); | ||
|
||
await initBlussuvoll({ prismaClient }); | ||
await createNoobTasks({ prismaClient }); | ||
|
||
console.info( | ||
`\n🌴 Done seeding database for production after ${differenceInSeconds( | ||
new Date(), | ||
timer | ||
)}s!` | ||
); | ||
console.info("--- --- --- --- --- --- ---"); | ||
} | ||
|
||
await init(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { Prisma, PrismaClient } from "@prisma/client"; | ||
import { differenceInSeconds } from "date-fns"; | ||
|
||
const categories: Prisma.CategoryCreateInput[] = [ | ||
// From school book | ||
{ id: "cler3mpi9000108kxdzogagj4", name: "Funksjon og graf" }, | ||
{ id: "cldacdi520001sbxekmyct9yd", name: "Lineære funksjoner" }, | ||
{ id: "cler3o0ps000208kxhg7u2v0n", name: "Brøkfunksjoner" }, | ||
{ id: "cler3oqyo000308kxe2au80ds", name: "Andregradsfunksjoner" }, | ||
{ id: "cleebx9wi000508jt5ik9fgpx", name: "Eksponentialfunksjoner" }, | ||
|
||
// Other | ||
// { id: "cldacdi520000sbxe8eyqu26y", name: "Algebra" }, | ||
// { id: "cleeb63a5000008judykn4061", name: "Kvadratiske funksjoner" }, | ||
// { | ||
// id: "cleeckaww000108l4h4gjekif", | ||
// name: "Omvendt proporsjonale funksjoner", | ||
// }, | ||
// { id: "cldacdi530002sbxeu6rgijzl", name: "Likninger" }, | ||
// { id: "cldx7ez8a000008juf4sl1wdq", name: "Økonomi" }, | ||
{ id: "cle791t0y000308ml7zsw59wo", name: "Noobs" }, | ||
]; | ||
|
||
export async function createCategories({ | ||
prismaClient, | ||
}: { | ||
prismaClient: PrismaClient; | ||
}) { | ||
const timer = new Date(); | ||
console.info("\n📒 Seeding categories..."); | ||
|
||
const data = await prismaClient.$transaction( | ||
categories.map((category) => | ||
prismaClient.category.upsert({ | ||
where: { id: category.id }, | ||
create: category, | ||
update: category, | ||
}) | ||
) | ||
); | ||
|
||
console.log(`Took ${differenceInSeconds(new Date(), timer)}s`); | ||
|
||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import type { Prisma, PrismaClient } from "@prisma/client"; | ||
import { differenceInSeconds } from "date-fns"; | ||
|
||
const providedTasks: Prisma.TaskCreateInput[] = [ | ||
{ | ||
id: "cler3i0se000008kxdq1adnxh", | ||
title: "Oppgave 2.23", | ||
description: | ||
"Lag et funksjonsuttrykk som viser tilbakelagt strekning math$S(x)& når du sykler x timer med en hastighet pa 25 km/h.", | ||
answer: "S(x)=25x", | ||
category: { connect: { id: "cldacdi520001sbxekmyct9yd" } }, | ||
answerType: "FUNCTION_ANSWER", | ||
placeholder: "S(x)=\\placeholder[blank1]{}x", | ||
points: 100, | ||
}, | ||
{ | ||
id: "cler4dqoq000007l6hulb6r27", | ||
title: "Oppgave 2.24a", | ||
description: | ||
"Erona kjøper x kg epler til 15 kr per kilogram og en boks med druer til 30 kr. Hun betaler P kr til sammen. Lag et funksjonsuttrykk math$P(x)& som viser hvor mye hun må betale.", | ||
answer: "P(x)=15x+30", | ||
answerType: "FUNCTION_ANSWER", | ||
placeholder: "P(x)=\\placeholder[blank1]{}x+\\placeholder[blank2]", | ||
points: 50, | ||
category: { connect: { id: "cldacdi520001sbxekmyct9yd" } }, | ||
}, | ||
{ | ||
id: "cler4fya3000107l682qc4to3", | ||
title: "Oppgave 2.24b", | ||
description: | ||
"Erona kjøper x kg epler til 15 kr per kilogram og en boks med druer til 30 kr. Bruk funksjonsuttrykket til å finne ut hvor mye Erona skal betale for 2.5 kg epler og én boks druer?", | ||
answer: "67.50kr", | ||
hint: "DECIMAL", | ||
placeholder: "\\placeholder[blank1]{}kr", | ||
points: 75, | ||
category: { connect: { id: "cldacdi520001sbxekmyct9yd" } }, | ||
prevTask: { connect: { id: "cler4dqoq000007l6hulb6r27" } }, | ||
}, | ||
]; | ||
|
||
export async function createDayOneTasks({ | ||
prismaClient, | ||
}: { | ||
prismaClient: PrismaClient; | ||
}) { | ||
const timer = new Date(); | ||
console.info("\n📝 Seeding provided tasks..."); | ||
|
||
const data = await prismaClient.$transaction( | ||
providedTasks.map((task) => | ||
prismaClient.task.upsert({ | ||
where: { id: task.id }, | ||
create: task, | ||
update: task, | ||
}) | ||
) | ||
); | ||
|
||
console.log(`Took ${differenceInSeconds(new Date(), timer)}s`); | ||
|
||
return data; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { PrismaClient } from "@prisma/client"; | ||
import { differenceInSeconds } from "date-fns"; | ||
import { createUsers } from "../utils/user-utilities"; | ||
import { createCategories } from "./categories"; | ||
import { createDayOneTasks } from "./day-one-tasks"; | ||
import { createEquationTasks } from "./old-tasks/equations"; | ||
import { createExponentialTasks } from "./old-tasks/exponential"; | ||
import { createInverseProportionalFunctionTasks } from "./old-tasks/inverse"; | ||
import { createLinearTasks } from "./old-tasks/linear"; | ||
import { createQuadraticTasks } from "./old-tasks/quadratic"; | ||
import { userList as users } from "./user-list"; | ||
|
||
const createOldTasks = async ({ | ||
prismaClient, | ||
}: { | ||
prismaClient: PrismaClient; | ||
}) => { | ||
const timer = new Date(); | ||
console.info("🏫 Seeding tasks for Blussuvoll ..."); | ||
|
||
await createEquationTasks({ prismaClient }); | ||
await createExponentialTasks({ prismaClient }); | ||
await createInverseProportionalFunctionTasks({ prismaClient }); | ||
await createLinearTasks({ prismaClient }); | ||
await createQuadraticTasks({ prismaClient }); | ||
|
||
console.log(`Took ${differenceInSeconds(new Date(), timer)}s`); | ||
}; | ||
|
||
export const initBlussuvoll = async ({ | ||
prismaClient, | ||
}: { | ||
prismaClient: PrismaClient; | ||
}) => { | ||
console.info("🏫 Initializing Blussuvoll ..."); | ||
|
||
await createCategories({ prismaClient }); | ||
await createUsers({ prismaClient, users, withAdmins: true }); | ||
await createDayOneTasks({ prismaClient }); | ||
|
||
// await createOldTasks({ prismaClient }); | ||
}; |
Oops, something went wrong.
63bb518
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
skillsprint – ./
skillsprint.no
skillsprint-git-main-lekesoldat.vercel.app
skillsprint-lekesoldat.vercel.app
skillsprint.vercel.app
www.skillsprint.no