-
Notifications
You must be signed in to change notification settings - Fork 80
Cart analysis changes #1038
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
antgonza
merged 24 commits into
qiita-spots:cart-branch
from
squirrelo:cart-analysis-changes
Apr 7, 2015
Merged
Cart analysis changes #1038
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
90339fd
skeleton for demoing
squirrelo 72267a0
add conformation to removing proc data
squirrelo 10f077d
Merge branch 'master' of https://github.com/biocore/qiita into cart-a…
squirrelo f1ca570
add patch to create default analyses for all existing users
squirrelo e362c25
add default analysis on user creation
squirrelo cfe9ba2
streamline UI for cart
squirrelo 28f8480
further refining IU
squirrelo f0c3f80
add default analyses using only SQL
squirrelo 6d30936
changes to tests to reflect patch
squirrelo 4f3756f
fix more tests, add analysis_workflow steps for carts
squirrelo b5bf4ed
update user private_analyses to ignore default cart
squirrelo 68488c7
update test again to reflect change
squirrelo 90b3de2
merge upstream/master
squirrelo bd3d513
Merge branch 'master' of https://github.com/biocore/qiita into cart-a…
squirrelo f5026f8
move default analysis pull to user object
squirrelo 874632b
implement the default_analysis in qiita_pet
squirrelo ddf2ff4
more comments addressed
squirrelo 1dc1440
pep8
squirrelo cf1123f
remove magic numbers from tests
squirrelo 15c71dc
replace processed_date retriveal
squirrelo 8e129e6
add info modal for proc data
squirrelo e784006
more UI changes
squirrelo d7b4778
couple small UI changes
squirrelo ba42c6a
use info glyph
squirrelo 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
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,14 @@ | ||
-- March 28, 2015 | ||
-- Add default analyses for all existing users | ||
DO $do$ | ||
DECLARE | ||
eml varchar; | ||
aid bigint; | ||
BEGIN | ||
FOR eml IN | ||
SELECT email FROM qiita.qiita_user | ||
LOOP | ||
INSERT INTO qiita.analysis (email, name, description, dflt, analysis_status_id) VALUES (eml, eml || '-dflt', 'dflt', true, 1) RETURNING analysis_id INTO aid; | ||
INSERT INTO qiita.analysis_workflow (analysis_id, step) VALUES (aid, 2); | ||
END LOOP; | ||
END $do$; |
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
from qiita_db.job import Job | ||
from qiita_db.user import User | ||
from qiita_db.exceptions import QiitaDBStatusError | ||
from qiita_db.util import get_mountpoint | ||
from qiita_db.util import get_mountpoint, get_count | ||
from qiita_db.study import Study, StudyPerson | ||
from qiita_db.data import ProcessedData | ||
from qiita_db.metadata_template import SampleTemplate | ||
|
@@ -92,36 +92,36 @@ def test_has_access_no_access(self): | |
def test_create(self): | ||
sql = "SELECT EXTRACT(EPOCH FROM NOW())" | ||
time1 = float(self.conn_handler.execute_fetchall(sql)[0][0]) | ||
|
||
new_id = get_count("qiita.analysis") + 1 | ||
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. Nice! 😄 |
||
new = Analysis.create(User("admin@foo.bar"), "newAnalysis", | ||
"A New Analysis") | ||
self.assertEqual(new.id, 3) | ||
self.assertEqual(new.id, new_id) | ||
sql = ("SELECT analysis_id, email, name, description, " | ||
"analysis_status_id, pmid, EXTRACT(EPOCH FROM timestamp) " | ||
"FROM qiita.analysis WHERE analysis_id = 3") | ||
obs = self.conn_handler.execute_fetchall(sql) | ||
self.assertEqual(obs[0][:-1], [3, 'admin@foo.bar', 'newAnalysis', | ||
"FROM qiita.analysis WHERE analysis_id = %s") | ||
obs = self.conn_handler.execute_fetchall(sql, [new_id]) | ||
self.assertEqual(obs[0][:-1], [new_id, 'admin@foo.bar', 'newAnalysis', | ||
'A New Analysis', 1, None]) | ||
self.assertTrue(time1 < float(obs[0][-1])) | ||
|
||
def test_create_parent(self): | ||
sql = "SELECT EXTRACT(EPOCH FROM NOW())" | ||
time1 = float(self.conn_handler.execute_fetchall(sql)[0][0]) | ||
|
||
new_id = get_count("qiita.analysis") + 1 | ||
new = Analysis.create(User("admin@foo.bar"), "newAnalysis", | ||
"A New Analysis", Analysis(1)) | ||
self.assertEqual(new.id, 3) | ||
self.assertEqual(new.id, new_id) | ||
sql = ("SELECT analysis_id, email, name, description, " | ||
"analysis_status_id, pmid, EXTRACT(EPOCH FROM timestamp) " | ||
"FROM qiita.analysis WHERE analysis_id = 3") | ||
obs = self.conn_handler.execute_fetchall(sql) | ||
self.assertEqual(obs[0][:-1], [3, 'admin@foo.bar', 'newAnalysis', | ||
"FROM qiita.analysis WHERE analysis_id = %s") | ||
obs = self.conn_handler.execute_fetchall(sql, [new_id]) | ||
self.assertEqual(obs[0][:-1], [new_id, 'admin@foo.bar', 'newAnalysis', | ||
'A New Analysis', 1, None]) | ||
self.assertTrue(time1 < float(obs[0][-1])) | ||
|
||
sql = "SELECT * FROM qiita.analysis_chain WHERE child_id = 3" | ||
obs = self.conn_handler.execute_fetchall(sql) | ||
self.assertEqual(obs, [[1, 3]]) | ||
sql = "SELECT * FROM qiita.analysis_chain WHERE child_id = %s" | ||
obs = self.conn_handler.execute_fetchall(sql, [new_id]) | ||
self.assertEqual(obs, [[1, new_id]]) | ||
|
||
def test_retrieve_owner(self): | ||
self.assertEqual(self.analysis.owner, "test@foo.bar") | ||
|
@@ -242,21 +242,23 @@ def test_retrieve_biom_tables_none(self): | |
self.assertEqual(new.biom_tables, None) | ||
|
||
def test_set_step(self): | ||
new_id = get_count("qiita.analysis") + 1 | ||
new = Analysis.create(User("admin@foo.bar"), "newAnalysis", | ||
"A New Analysis", Analysis(1)) | ||
new.step = 2 | ||
sql = "SELECT * FROM qiita.analysis_workflow WHERE analysis_id = 3" | ||
obs = self.conn_handler.execute_fetchall(sql) | ||
self.assertEqual(obs, [[3, 2]]) | ||
sql = "SELECT * FROM qiita.analysis_workflow WHERE analysis_id = %s" | ||
obs = self.conn_handler.execute_fetchall(sql, [new_id]) | ||
self.assertEqual(obs, [[new_id, 2]]) | ||
|
||
def test_set_step_twice(self): | ||
new_id = get_count("qiita.analysis") + 1 | ||
new = Analysis.create(User("admin@foo.bar"), "newAnalysis", | ||
"A New Analysis", Analysis(1)) | ||
new.step = 2 | ||
new.step = 4 | ||
sql = "SELECT * FROM qiita.analysis_workflow WHERE analysis_id = 3" | ||
obs = self.conn_handler.execute_fetchall(sql) | ||
self.assertEqual(obs, [[3, 4]]) | ||
sql = "SELECT * FROM qiita.analysis_workflow WHERE analysis_id = %s" | ||
obs = self.conn_handler.execute_fetchall(sql, [new_id]) | ||
self.assertEqual(obs, [[new_id, 4]]) | ||
|
||
def test_retrieve_step(self): | ||
new = Analysis.create(User("admin@foo.bar"), "newAnalysis", | ||
|
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
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
Oops, something went wrong.
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.
Can these 2 sql be a single left (or right) join?
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.
No, since it is dynamic table info so we need the table name and row from the first to do the second query.
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.
OK, I think your method is way simpler even if it requires 2 queries.