Skip to content

Conversation

@squirrelo
Copy link
Contributor

Requires #1590

Adds the admin approvals buttons to the interface. Can now change the visibility of all the artifacts individually. Also adds the submit to EBI and VAMPS buttons when applicable.

@antgonza
Copy link
Member

antgonza commented Feb 8, 2016

@squirrelo which should we review next, this one or #1602 ? Thanks!

@squirrelo
Copy link
Contributor Author

This one.

@antgonza
Copy link
Member

antgonza commented Feb 8, 2016

Thanks, please let us know when should we proceed.

@squirrelo
Copy link
Contributor Author

ready for review.

if access_error:
return access_error

try:
Copy link
Member

Choose a reason for hiding this comment

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

These 3 try/except don't make sense, can you change? Or perhaps I'm missing something?

Copy link
Member

Choose a reason for hiding this comment

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

BTW they are also missing tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

condensed

Copy link
Contributor

Choose a reason for hiding this comment

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

can_be_submitted_to_ebi is a boolean that tells you if you can query the next attribute or not. Please, use an if statement rather than an exception. try/except should be used when something unexpected may happen, not as a substitute of an if:

can_be_submitted_to_ebi = pd.can_be_submitted_to_ebi
ebi_run_accessions = pd.ebi_run_accessions if can_be_submitted_to_ebi else None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@squirrelo
Copy link
Contributor Author

Merge issues taken care of, so missing tests and docstrings should be in place now.

try:
can_be_submitted_to_ebi = pd.can_be_submitted_to_ebi
ebi_run_accessions = pd.ebi_run_accessions
except QiitaDBOperationNotPermittedError:
Copy link
Member

Choose a reason for hiding this comment

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

Can you add tests for the except?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already in

@antgonza
Copy link
Member

A few more comments.

return access_error
user = User(str(user_id))
# Set the approval to private if needs approval and admin
if all([qiita_config.require_approval, visibility == 'private',
Copy link
Contributor

Choose a reason for hiding this comment

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

The first three if statements have common checks. Please extract common checks and use nested ifs to avoid evaluating multiple times the same expression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

fp = join(qiita_config.base_data_dir, 'uploads',
str(self.new_study.id), 'uploaded_file.txt')
base_dir = qdb.util.get_mountpoint('uploads')[0][1]
fp = join(base_dir, str(self.new_study.id), 'uploaded_file.txt')
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 it will simplify the handling of the tests if you don't use this test (note code duplication here and in tearDown).
My recommendation would be that you actually create a new file using mkstemp (note that you can indicate the directory in which you want it) and just remove it in the tearDown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no code duplication. One creates a file for the new study upload folder, the other replaces the file for the existing study.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it means that the new file created for the new study is not deleted in the tearDown?

Copy link
Contributor

Choose a reason for hiding this comment

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

@squirrelo ping about this one

@josenavas
Copy link
Contributor

done with the review.

@squirrelo
Copy link
Contributor Author

Comments addressed

return qdb.sql_connection.TRN.execute_fetchindex()


def get_visibilities():
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing tests

@josenavas
Copy link
Contributor

Few comments

@josenavas
Copy link
Contributor

@squirrelo ETA on addressing the comments here?

@squirrelo
Copy link
Contributor Author

All comments have been addressed

access_error = check_access(pd.study.id, user_id)
if access_error:
return access_error
user = User(str(user_id))
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity - why the specific cast to str in here? it looks unnecessary as you've already said before that everything is passed as a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was casting explicitly to int for the other objects so I just followed the same pattern and did an explicit cast here as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, the reasoning doesn't apply here but it is ok - no need to change.

@josenavas
Copy link
Contributor

Still some unresolved comments here.

josenavas added a commit that referenced this pull request Feb 12, 2016
@josenavas josenavas merged commit 3b9290e into qiita-spots:artifact-study-pages Feb 12, 2016
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.

3 participants