-
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.
Oppdaterer script og legger til nye undertemaer
- Loading branch information
Showing
13 changed files
with
1,058 additions
and
259 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -1,20 +1,25 @@ | ||
from pydantic import BaseModel | ||
from typing import Annotated | ||
from pydantic import BaseModel, StringConstraints | ||
from main.util.generer_uuider import generer_uuid_med_delay | ||
from main.dataklasser.Svaralternativ import Svaralternativ, lagSvaralternativer | ||
from main.dataklasser.Svaralternativ import Svaralternativ | ||
|
||
|
||
class Spørsmål(BaseModel): | ||
tekst: str | ||
id: Annotated[str, StringConstraints(min_length=36, max_length=36)] | ||
flervalg: bool = False | ||
svaralternativer: list[Svaralternativ] = lagSvaralternativer( | ||
def lagSvaralternativer(alternativer: list[str]) -> list[Svaralternativ]: | ||
return [Svaralternativ(tekst=alternativ) for alternativ in alternativer] | ||
|
||
|
||
class Spørsmål: | ||
def __init__( | ||
self, | ||
tekst: str, | ||
flervalg: bool = False, | ||
alternativer=[ | ||
"Helt enig", | ||
"Litt enig", | ||
"Litt uenig", | ||
"Helt uenig", | ||
"Vet ikke", | ||
] | ||
) | ||
], | ||
): | ||
self.id = generer_uuid_med_delay() | ||
self.tekst = tekst | ||
self.flervalg = flervalg | ||
self.svaralternativer = lagSvaralternativer(alternativer=alternativer) |
17 changes: 4 additions & 13 deletions
17
scripts/spørreundersøkelse/main/dataklasser/Svaralternativ.py
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 |
---|---|---|
@@ -1,16 +1,7 @@ | ||
from pydantic import BaseModel | ||
from typing import Annotated | ||
from pydantic import BaseModel, StringConstraints | ||
from main.util.generer_uuider import generer_uuid_med_delay | ||
|
||
|
||
class Svaralternativ(BaseModel): | ||
id: Annotated[str, StringConstraints(min_length=36, max_length=36)] | ||
tekst: str | ||
|
||
|
||
def lagSvaralternativer(alternativer: list[str]) -> list[Svaralternativ]: | ||
return [ | ||
Svaralternativ(id=generer_uuid_med_delay(), tekst=alternativ) | ||
for alternativ in alternativer | ||
] | ||
class Svaralternativ: | ||
def __init__(self, tekst: str): | ||
self.id = generer_uuid_med_delay() | ||
self.tekst = tekst |
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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
from typing import Literal | ||
from pydantic import BaseModel | ||
from main.dataklasser.Undertema import Undertema | ||
|
||
|
||
class Tema(BaseModel): | ||
id: int | ||
navn: Literal["Partssamarbeid", "Sykefraværsarbeid", "Arbeidsmiljø"] | ||
rekkefølge: int | ||
type: Literal["Behovsvurdering", "Evaluering"] | ||
undertemaer: list[Undertema] | ||
class Tema: | ||
def __init__( | ||
self, | ||
id: int, | ||
navn: Literal["Partssamarbeid", "Sykefraværsarbeid", "Arbeidsmiljø"], | ||
type: Literal["Behovsvurdering", "Evaluering"], | ||
undertemaer: list[Undertema], | ||
): | ||
self.id = id | ||
self.navn = navn | ||
self.type = type | ||
self.undertemaer = undertemaer |
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 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
Oops, something went wrong.