rearrange
This commit is contained in:
parent
b8b01e4a4a
commit
9353701af3
27 changed files with 85 additions and 186 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1 +1,5 @@
|
|||
/result
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
|
|
39
README.md
39
README.md
|
@ -1 +1,38 @@
|
|||
eduproj
|
||||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init svelte@next
|
||||
|
||||
# create a new project in my-app
|
||||
npm init svelte@next my-app
|
||||
```
|
||||
|
||||
> Note: the `@next` is temporary
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
||||
|
|
41
flake.lock
41
flake.lock
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1629481132,
|
||||
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1630125726,
|
||||
"narHash": "sha256-STeKWv2RQCTwA9FEAiGCcO9l+CiXhVuaTl1bz3mJRxw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "45131df1671d5886821908b5294f5fba5fb23fc7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
23
flake.nix
23
flake.nix
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
outputs = { self, flake-utils, nixpkgs }:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pythonPkgs = pkgs.python39Packages;
|
||||
flakePkgs = rec {
|
||||
material = pkgs.callPackage ./material {};
|
||||
sm2 = pythonPkgs.callPackage ./sm2 {};
|
||||
};
|
||||
in rec {
|
||||
defaultPackage = packages.sm2;
|
||||
devShell = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
(python39.withPackages (p: with p; [
|
||||
flask
|
||||
]))
|
||||
];
|
||||
};
|
||||
packages = flake-utils.lib.flattenTree flakePkgs;
|
||||
});
|
||||
}
|
0
web/package-lock.json → package-lock.json
generated
0
web/package-lock.json → package-lock.json
generated
1
result
Symbolic link
1
result
Symbolic link
|
@ -0,0 +1 @@
|
|||
/nix/store/6z8hvajcipvnzqc64hk9qln9svly2idk-python3.9-sm2
|
|
@ -1,19 +0,0 @@
|
|||
{ buildPythonPackage, nix-gitignore, python, mypy }:
|
||||
|
||||
let
|
||||
pythonBuildInputs = [ ];
|
||||
pythonWithBuildInputs = python.withPackages (_: pythonBuildInputs);
|
||||
in
|
||||
buildPythonPackage {
|
||||
name = "sm2";
|
||||
src = nix-gitignore.gitignoreSourcePure [ ../.gitignore ] ./.;
|
||||
|
||||
doCheck = true;
|
||||
checkInputs = [ mypy ];
|
||||
checkPhase = ''
|
||||
${mypy}/bin/mypy --no-color-output \
|
||||
--package sm2 \
|
||||
--python-executable ${pythonWithBuildInputs}/bin/python \
|
||||
--strict
|
||||
'';
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name = "sm2",
|
||||
packages = ["sm2"],
|
||||
)
|
|
@ -1,43 +0,0 @@
|
|||
from typing import Tuple
|
||||
|
||||
def sm2_algo(
|
||||
user_grade: int,
|
||||
n: int,
|
||||
ef: float,
|
||||
i: int,
|
||||
) -> Tuple[int, float, int]:
|
||||
"""
|
||||
From https://en.wikipedia.org/wiki/SuperMemo#Description_of_SM-2_algorithm
|
||||
|
||||
n: repetition number, how many times a number was repeated
|
||||
ef: easiness-factor, how quickly the interval grows
|
||||
i: interval (in days)
|
||||
|
||||
returns the updated version of these values
|
||||
"""
|
||||
|
||||
# grade >= 3 means the response was correct
|
||||
if user_grade >= 3:
|
||||
# update the number of days until the next review
|
||||
# increases exponentially starting with 1 day and 6 days
|
||||
if n == 0:
|
||||
i = 1
|
||||
elif n == 1:
|
||||
i = 6
|
||||
else:
|
||||
i = round(i * ef)
|
||||
|
||||
# increment the number of days
|
||||
n += 1
|
||||
|
||||
# incorrect
|
||||
else:
|
||||
n = 0
|
||||
i = 1
|
||||
|
||||
inv_grade = 5 - user_grade
|
||||
ef = ef + (0.1 - inv_grade * (0.08 + inv_grade * 0.02))
|
||||
if ef < 1.3:
|
||||
ef = 1.3
|
||||
|
||||
return (n, ef, i)
|
0
web/src/global.d.ts → src/global.d.ts
vendored
0
web/src/global.d.ts → src/global.d.ts
vendored
5
src/lib/MasteryDemo.svelte
Normal file
5
src/lib/MasteryDemo.svelte
Normal file
|
@ -0,0 +1,5 @@
|
|||
<script lang="ts">
|
||||
import QuizBox from "$lib/QuizBox.svelte";
|
||||
</script>
|
||||
|
||||
<QuizBox />
|
|
@ -26,7 +26,7 @@
|
|||
{#if state == "ask" }
|
||||
<small>Q:</small>
|
||||
<p>{ question.description }</p>
|
||||
<ul>
|
||||
<ul class="choices">
|
||||
{#each question.choices as choice, index }
|
||||
<li>
|
||||
<button on:click={() => choose(index)}>{ choice.text }</button>
|
||||
|
@ -44,8 +44,24 @@
|
|||
</div>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.quiz-box {
|
||||
border: 1px solid gray;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.quiz-box {
|
||||
border: 1px solid gray;
|
||||
border-radius: 8px;
|
||||
|
||||
.choices {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
flex-grow: 1;
|
||||
margin: 12px;
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -3,10 +3,10 @@
|
|||
<div class="brand"><a href="/">Edu</a></div>
|
||||
<nav class="header-nav">
|
||||
<ul class="list list-reset">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about">About</a></li>
|
||||
<li><a href="/learn">Learn</a></li>
|
||||
<li><a href="/browse">Browse</a></li>
|
||||
<li><a href="/login">Login</a></li>
|
||||
<li><a href="/contribute">Contribute</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -78,6 +78,13 @@
|
|||
|
||||
.brand {
|
||||
margin-right: 32px;
|
||||
|
||||
a {
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
}
|
||||
|
||||
.header-nav {
|
4
src/routes/about.svelte
Normal file
4
src/routes/about.svelte
Normal file
|
@ -0,0 +1,4 @@
|
|||
<h2>How does it work?</h2>
|
||||
|
||||
<ul>
|
||||
</ul>
|
|
@ -1,10 +1,10 @@
|
|||
<script lang="ts">
|
||||
import QuizBox from "$lib/QuizBox.svelte";
|
||||
import MasteryDemo from "$lib/MasteryDemo.svelte";
|
||||
</script>
|
||||
|
||||
<h1>Learn by mastery</h1>
|
||||
|
||||
<QuizBox />
|
||||
<MasteryDemo />
|
||||
|
||||
<p>
|
||||
yadda yadda yadda what's unique about this mastery based learning appraoch
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
5
web/.gitignore
vendored
5
web/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
|
@ -1,38 +0,0 @@
|
|||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init svelte@next
|
||||
|
||||
# create a new project in my-app
|
||||
npm init svelte@next my-app
|
||||
```
|
||||
|
||||
> Note: the `@next` is temporary
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
Loading…
Reference in a new issue