cohen990 / VoxPop

The voice of the people in pictures!
0 stars 0 forks source link

Author stories needs refactoring #105

Closed cohen990 closed 9 years ago

cohen990 commented 9 years ago

Currently, we are grabbing all stories and selecting the ones for a given author within the view itself.

Needs to be refactored to grab only the stories on interest within the store itself.

Can be done by changing the line

IEnumerable<BlogPostEntity> entities = _table.ExecuteQuery(query).Select(x => x);

to

IEnumerable<BlogPostEntity> entities = _table.ExecuteQuery(query)
    .Where(x => x.PartitionKey == entityPartitionKey)
    .Select(x => x);

This will allow us to remove some of the logic from the AuthorStories.cshtml

e.g. if (@blogPost.PartitionKey == currentAuthorUN)

Also need to change AuthorStories.cshtml to expect a BlogModel instead of a BlogPostEntity

cohen990 commented 9 years ago

what this comes down to is saying, for each blog, if the author id (the blog partition key) is equal to the one we requested, then select those blogs and return them.