-
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.
Merge pull request #6 from epwr/feature/adding-questions
Feature/adding questions
- Loading branch information
Showing
19 changed files
with
443 additions
and
143 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 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,3 +1,4 @@ | ||
__all__ = ["Survey"] | ||
__all__ = ["Survey", "TextQuestion"] | ||
|
||
from .survey import Survey | ||
from .text_question import TextQuestion |
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,13 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class BaseDataModel(BaseModel): | ||
""" """ | ||
|
||
def __eq__(self, other: object) -> bool: | ||
if not isinstance(other, self.__class__): | ||
return NotImplemented | ||
return all( | ||
self.__getattribute__(field) == other.__getattribute__(field) | ||
for field in self.__annotations__.keys() | ||
) |
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 |
---|---|---|
@@ -1,19 +1,11 @@ | ||
from pydantic import BaseModel, Field | ||
from uuid import UUID, uuid4 | ||
from pydantic import Field | ||
|
||
|
||
class Survey(BaseModel): | ||
from .base_data_model import BaseDataModel | ||
|
||
|
||
class Survey(BaseDataModel): | ||
uid: UUID = Field(default_factory=uuid4) | ||
name: str | ||
is_open: bool | ||
|
||
def __eq__(self, other: object) -> bool: | ||
if not isinstance(other, Survey): | ||
return NotImplemented | ||
return all( | ||
( | ||
self.uid == other.uid, | ||
self.name == other.name, | ||
self.is_open == other.is_open, | ||
) | ||
) |
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,10 @@ | ||
from uuid import UUID, uuid4 | ||
from pydantic import Field | ||
|
||
from .base_data_model import BaseDataModel | ||
|
||
|
||
class TextQuestion(BaseDataModel): | ||
uid: UUID = Field(default_factory=uuid4) | ||
survey_uid: UUID | ||
question: str |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
{% extends '_layout.html' %} | ||
|
||
{% block content %} | ||
<h3>{{survey.name}}</h3> | ||
<h1>{{survey.name}}</h3> | ||
|
||
Not Implemented | ||
<div> | ||
{% for question in questions %} | ||
<h2>{{question.question}}</h2> | ||
{% endfor %} | ||
<div> | ||
|
||
Answering Questions is not yet implemented. | ||
|
||
{% endblock %} |
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 @@ | ||
INSERT INTO survey ( | ||
uid | ||
, name | ||
, is_open | ||
) VALUES ( | ||
'4b5bfb06-2060-4abf-b5fd-3bae5dcf72b9' | ||
, 'Example Survey #1' | ||
, TRUE | ||
); | ||
|
||
INSERT INTO text_question ( | ||
uid | ||
, survey_uid | ||
, question | ||
) VALUES ( | ||
'9c9facb5-f360-4155-852a-8e2ac04607ea' | ||
, '4b5bfb06-2060-4abf-b5fd-3bae5dcf72b9' | ||
, 'What is your name?' | ||
), ( | ||
'ee947616-3d16-4095-bc8f-603be72022d3' | ||
, '4b5bfb06-2060-4abf-b5fd-3bae5dcf72b9' | ||
, 'Are you sure?' | ||
); |
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.