Skip to content

Commit

Permalink
SuggestionsIntegrationTests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Zhou committed Jan 31, 2016
1 parent 5205533 commit 91d996d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 4 additions & 0 deletions core/controllers/feedback_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,10 @@ def test_actions_related_to_suggestions(self):
rejected_suggestion_thread_id = threads[1]['thread_id']
unsuccessful_accept_thread_id = threads[2]['thread_id']

self.assertEqual(threads[0]['subject'], 'Suggestion for state A.')
self.assertEqual(threads[1]['subject'], 'A new value.')
self.assertEqual(threads[2]['subject'], 'Empty suggestion')

# Accept a suggestion.
self._accept_suggestion(accepted_suggestion_thread_id, csrf_token)
updated_exploration = exp_services.get_exploration_by_id(self.EXP_ID)
Expand Down
15 changes: 3 additions & 12 deletions core/storage/feedback/gae_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,8 @@ def get_threads(cls, exploration_id):
Does not include the deleted entries.
"""
return cls.get_all().filter(
cls.exploration_id == exploration_id).fetch(
feconf.DEFAULT_QUERY_LIMIT)

@classmethod
def get_threads_with_suggestions(cls, exploration_id):
"""Returns an array of threads that have suggestions, for the given
exploration."""

return cls.get_all().filter(
cls.exploration_id == exploration_id).filter(
cls.has_suggestion == True).fetch(feconf.DEFAULT_QUERY_LIMIT) # pylint: disable=singleton-comparison
cls.exploration_id == exploration_id).order(
cls.last_updated).fetch(feconf.DEFAULT_QUERY_LIMIT)


class FeedbackMessageModel(base_models.BaseModel):
Expand Down Expand Up @@ -261,7 +252,7 @@ class SuggestionModel(base_models.BaseModel):
# Name of the corresponding state.
state_name = ndb.StringProperty(required=True, indexed=True)
# Learner-provided description of suggestion changes.
description = ndb.StringProperty(required=True, indexed=True)
description = ndb.TextProperty(required=True, indexed=False)
# The state's content after the suggested edits.
# Contains keys 'type' (always 'text') and 'value' (the actual content).
state_content = ndb.JsonProperty(required=True, indexed=False)
Expand Down
6 changes: 6 additions & 0 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ indexes:
- name: last_updated
direction: desc

- kind: FeedbackThreadModel
properties:
- name: deleted
- name: exploration_id
- name: last_updated

- kind: JobModel
properties:
- name: status_code
Expand Down

0 comments on commit 91d996d

Please sign in to comment.