-
Notifications
You must be signed in to change notification settings - Fork 1
Release/0.3.0 #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Unix-Code
wants to merge
23
commits into
master
Choose a base branch
from
release/0.3.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Release/0.3.0 #75
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e96c101
Added searching/highlighting support for instructors
Unix-Code 4217581
Added searching/highlighting support for instructors
Unix-Code 9d38b91
Refactored searching/highlighting to be more DRY with a base class
Unix-Code 666fc04
fixing merge
danguddemi da289f3
Merge pull request #48 from chilipot/feature/add-searching-for-instru…
danguddemi be90083
Feature/serverless transition (#50)
Unix-Code 9be8941
Feature/fix pipeline code and imports (#51)
Unix-Code db47fdb
Feature/serverless transition pt2 (#52)
Unix-Code 0e941a8
Patch/app environment in serverless config (#54)
Unix-Code f2e1888
new index setup + config (#55)
Unix-Code 5774638
pin version (#56)
Unix-Code b08176a
faceting/filtering by multiple term, department, and instructor ids (…
Unix-Code 9fb4f18
added question categories
Unix-Code fe96f21
added survey controller functionality
Unix-Code d3d6c0b
Merge branches 'feature/add-question-categories' and 'integration' of…
Unix-Code e40d83b
added categories endpoint
Unix-Code f811ee9
fixed formatting
Unix-Code 5502e34
Merge pull request #58 from chilipot/feature/add-question-categories
danguddemi a7cf2b5
Add Gitter Badge
danguddemi 28b212b
Add Gitter Badge (#61)
danguddemi 22d3ada
Feature/categories for term (#72)
Unix-Code 52d5959
changelog
Unix-Code b17e10d
changelog
Unix-Code File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| ## 0.3.0 | ||
| * (feature) search questions/answers for category | ||
| * (feature) submitting review for a course report | ||
| * (patch) minor improvements to API + fortification of Flask architecture | ||
|
|
||
| ## 0.2.0 | ||
| * (feature) searching by instructor and department | ||
| * (patch) add app environment to serverless config |
This file contains hidden or 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 +1,2 @@ | ||
| [](https://circleci.com/gh/chilipot/TRACE-API/tree/master) | ||
| [](https://gitter.im/chilipot/TRACE-API?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 sqlalchemy import Column, Integer, ForeignKey | ||
|
|
||
| from api.model.mixins import Base, Dictable | ||
|
|
||
|
|
||
| class CategoryAnswers(Base, Dictable): | ||
| __tablename__ = 'category_answers' | ||
|
|
||
| lookup_answer_id = Column(Integer, ForeignKey('lookup_answer.id'), primary_key=True, nullable=False) | ||
| category_id = Column(Integer, ForeignKey('question_category.id'), primary_key=True, nullable=False) |
This file contains hidden or 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,12 +1,17 @@ | ||
| from sqlalchemy import Column, Integer, Unicode | ||
| from sqlalchemy.orm import relationship | ||
|
|
||
| from api.model.mixins import Base, Dictable | ||
|
|
||
|
|
||
| class LookupAnswer(Base, Dictable): | ||
| __tablename__ = 'lookup_answer' | ||
|
|
||
| dict_collapse = True | ||
| exclude_dict_fields = ["categories"] | ||
|
|
||
| # dict_collapse = True | ||
|
|
||
| id = Column(Integer, primary_key=True) | ||
| text = Column(Unicode(500)) | ||
|
|
||
| categories = relationship('QuestionCategory', secondary='category_answers', back_populates='answers') |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,5 +7,4 @@ | |
|
|
||
| class Base(_Base): | ||
| __abstract__ = True | ||
|
|
||
| query = db_session.query_property() | ||
This file contains hidden or 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 hidden or 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,10 +1,17 @@ | ||
| from sqlalchemy import Column, Integer, Unicode | ||
| from sqlalchemy.orm import relationship | ||
|
|
||
| from api.model.mixins import Base, Dictable | ||
|
|
||
|
|
||
| class QuestionCategory(Base, Dictable): | ||
| __tablename__ = 'question_category' | ||
|
|
||
| exclude_dict_fields = ['terms', 'answers'] | ||
|
|
||
| id = Column(Integer, primary_key=True) | ||
| text = Column(Unicode(250)) | ||
|
|
||
| answers = relationship('LookupAnswer', secondary='category_answers', back_populates='categories') | ||
| terms = relationship('Term', secondary='term_categories', back_populates='categories') | ||
| questions = relationship('LookupQuestion', back_populates='category') |
This file contains hidden or 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,24 @@ | ||
| from sqlalchemy import Column, Integer, ForeignKey | ||
| from sqlalchemy.orm import relationship | ||
|
|
||
| from api.model.mixins import Base, Dictable | ||
|
|
||
|
|
||
| class Response(Base, Dictable): | ||
| __tablename__ = 'responses' | ||
|
|
||
| id = Column(Integer, primary_key=True, nullable=False, autoincrement=True) | ||
| user_id = Column(Integer, nullable=False) | ||
| report_id = Column(Integer, ForeignKey('course.id'), nullable=False) | ||
| lookup_question_id = Column(Integer, ForeignKey('lookup_question.id'), nullable=False) | ||
| lookup_answer_id = Column(Integer, ForeignKey('lookup_answer.id'), nullable=False) | ||
|
|
||
| report = relationship('Course') | ||
| lookup_question = relationship('LookupQuestion') | ||
| lookup_answer = relationship('LookupAnswer') | ||
|
|
||
| def __init__(self, user_id, report_id, lookup_question_id, lookup_answer_id): | ||
| self.user_id = user_id | ||
| self.report_id = report_id | ||
| self.lookup_question_id = lookup_question_id | ||
| self.lookup_answer_id = lookup_answer_id |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -15,11 +15,3 @@ class ScoreData(Base, Dictable): | |
|
|
||
| course = relationship('Course', back_populates='score_data', uselist=False) | ||
| questions = relationship('Question', back_populates='score_data') | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How are you serializing objects now? |
||
| # Extra logic for special scores return | ||
| def as_dict(self, include_pk=True): | ||
| fields = super(ScoreData, self).as_dict(include_pk) | ||
| fields['id'] = fields.get('course', {}).get('id') | ||
| # Make cleaner | ||
| fields['comments'] = [comment._dict_or_collapsed(comment) for comment in self.course.comments] | ||
| return fields | ||
This file contains hidden or 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,14 +1,19 @@ | ||
| from sqlalchemy import Column, Integer, Unicode | ||
| from sqlalchemy.orm import relationship | ||
|
|
||
| from api.model.mixins import Base, Dictable | ||
|
|
||
|
|
||
| class Term(Base, Dictable): | ||
| __tablename__ = 'term' | ||
|
|
||
| exclude_dict_fields = ['categories'] | ||
|
|
||
| id = Column(Integer, primary_key=True) | ||
| title = Column(Unicode(200), nullable=False) | ||
|
|
||
| categories = relationship('QuestionCategory', secondary='term_categories', back_populates='terms') | ||
|
|
||
| @property | ||
| def normal_title(self): | ||
| return self.title.split(":").pop().strip().replace(' - ', ' ') |
This file contains hidden or 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 sqlalchemy import Column, Integer, ForeignKey | ||
|
|
||
| from api.model.mixins import Base, Dictable | ||
|
|
||
|
|
||
| class TermCategories(Base, Dictable): | ||
| __tablename__ = 'term_categories' | ||
|
|
||
| term_id = Column(Integer, ForeignKey('term.id'), primary_key=True, nullable=False) | ||
| category_id = Column(Integer, ForeignKey('question_category.id'), primary_key=True, nullable=False) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Mutable default arguments are bad.
This works better. You could also use an if conditional
def _dict_or_collapsed(obj, models_hit=None): models_hit = models_hit or []