Skip to content

delete sample template #1059

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

Merged
merged 9 commits into from
Apr 15, 2015
Merged

Conversation

antgonza
Copy link
Member

No description provided.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.09%) to 78.9% when pulling 1e3a802 on antgonza:delete-sample-template into 3aa8f73 on biocore:master.

queue,
"DROP TABLE IF EXISTS qiita.{0}".format(table_name))

conn_handler.add_to_queue(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the table twice? Also it should probably just be drop table, that way we get an error if the table doesn't exist. This will point out that the DB is in an inconsistent state.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@squirrelo
Copy link
Contributor

Couple comments. Also there is no test code for this delete function.

@antgonza
Copy link
Member Author

Comments addressed on last commit but not sure what you mean about tests, can you clarify? Note that the base-delete is tested both in there and the sample-template-delete.

@squirrelo
Copy link
Contributor

I meant qiita_pet test, sorry for not being clear.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.09%) to 78.9% when pulling e9d3345 on antgonza:delete-sample-template into 3aa8f73 on biocore:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.55%) to 79.55% when pulling 4e6099a on antgonza:delete-sample-template into 3aa8f73 on biocore:master.

@antgonza
Copy link
Member Author

antgonza commented Apr 13, 2015 via email

response = self.post('/study/description/1',
{'sample_template_id': 1,
'action': 'delete_sample_template'})
self.assertEqual(response.code, 200)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also make sure that the sample template is actually deleted here? Same goes for all other delete tests. Just want to make sure the functionality is actually happening along with the page loading fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, this isn't to make sure the delete function works, just that the delete page actually calls delete and the items are actually deleted when you hit the buttons on the page.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because the delete function works in qiita_db, doesn't mean the call works in qiita_pet. The delete function may change, breaking qiita_pet, or some other thing may change. If you test in qiita pet that the deletion actually happens, you know the functionality always works. As an example, in test_delete_raw_data, you can make sure that the QiitaDBIDError is raised when instantiating RawData(1) to make sure it was deleted by the page call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concrete example here Where the database change called for in the page is explicitly tested that it happens.

@squirrelo
Copy link
Contributor

One comment.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.49%) to 79.56% when pulling b47cbd5 on antgonza:delete-sample-template into 8c6a90d on biocore:master.

@antgonza
Copy link
Member Author

I have added the extra tests but while doing this I realized that it will be better to move the delete method from base_metadata_template.py to sample_template.py as the error raised by the method is specific to sample template. Note that the prep template has its own method. Ready for another review.

@josenavas
Copy link
Contributor

That is the easy solution for the delete. I will refactor it as a part of my work to get all changes from #1021 in the system...

@antgonza
Copy link
Member Author

antgonza commented Apr 15, 2015 via email

@@ -382,5 +382,57 @@ class TestEBISubmitHandler(TestHandlerBase):
pass


class TestDelete(TestHandlerBase):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this tests should include database = True; since they can potentially modify the database, in case of malfunction; making a lot of tests to fail and harder to find the original problem.

@josenavas
Copy link
Contributor

IMOO, it is very misleading that the button for removing the sample template is next to "Study information", since we are not removing the study information. Also it is the only tab on that group that has the x button to remove. I would suggest adding a glyphicon glyphicon-trash button in red next to the "Add samples to study". For other devs, this is how it currently looks like:

screen shot 2015-04-15 at 11 21 55 am

@josenavas
Copy link
Contributor

👍 @squirrelo is your comment about the tests solved? If so, can you merge once the tests pass?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.49%) to 79.56% when pulling 3a76380 on antgonza:delete-sample-template into 8c6a90d on biocore:master.

squirrelo added a commit that referenced this pull request Apr 15, 2015
@squirrelo squirrelo merged commit 39d15d2 into qiita-spots:master Apr 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants