Skip to content

Commit d66c453

Browse files
committed
'get_data_collection_group_ids' does not appear to be in use; deleted from Murfey
1 parent 06aad02 commit d66c453

File tree

2 files changed

+5
-54
lines changed

2 files changed

+5
-54
lines changed

src/murfey/server/ispyb.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -667,16 +667,3 @@ def get_all_ongoing_visits(microscope: str, db: Session | None) -> list[Visit]:
667667
)
668668
for row in query
669669
]
670-
671-
672-
def get_data_collection_group_ids(session_id):
673-
query = (
674-
ISPyBSession()
675-
.query(DataCollectionGroup)
676-
.filter(
677-
DataCollectionGroup.sessionId == session_id,
678-
)
679-
.all()
680-
)
681-
dcgids = [row.dataCollectionGroupId for row in query]
682-
return dcgids

tests/server/test_ispyb.py

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
from ispyb.sqlalchemy import BLSession, DataCollectionGroup, Proposal
1+
from ispyb.sqlalchemy import BLSession, Proposal
22
from pytest import mark
33
from sqlalchemy import select
44
from sqlalchemy.orm import Session
55

6-
from murfey.server.ispyb import (
7-
get_data_collection_group_ids,
8-
get_proposal_id,
9-
get_session_id,
10-
)
11-
from tests.conftest import ExampleVisit, ISPyBTableValues
6+
from murfey.server.ispyb import get_proposal_id, get_session_id
7+
from tests.conftest import ExampleVisit
128

139

1410
def test_get_session_id(
@@ -48,7 +44,7 @@ def test_get_proposal_id(
4844
ispyb_db_session.execute(
4945
select(Proposal)
5046
.where(Proposal.proposalCode == ExampleVisit.proposal_code)
51-
.where(Proposal.proposalNumber == ExampleVisit.proposal_number)
47+
.where(Proposal.proposalNumber == str(ExampleVisit.proposal_number))
5248
)
5349
.scalar_one()
5450
.proposalId
@@ -57,7 +53,7 @@ def test_get_proposal_id(
5753
# Test function
5854
result = get_proposal_id(
5955
proposal_code=ExampleVisit.proposal_code,
60-
proposal_number=ExampleVisit.proposal_number,
56+
proposal_number=str(ExampleVisit.proposal_number),
6157
db=ispyb_db_session,
6258
)
6359
assert proposal_id == result
@@ -71,35 +67,3 @@ def test_get_sub_samples_from_visit():
7167
@mark.skip
7268
def test_get_all_ongoing_visits():
7369
pass
74-
75-
76-
def test_get_data_collection_group_ids(
77-
ispyb_db_session: Session,
78-
):
79-
# Get the BLSession ID from test database
80-
bl_session_id = get_session_id(
81-
microscope=ExampleVisit.instrument_name,
82-
proposal_code=ExampleVisit.proposal_code,
83-
proposal_number=str(ExampleVisit.proposal_number),
84-
visit_number=str(ExampleVisit.visit_number),
85-
db=ispyb_db_session,
86-
)
87-
88-
# Add example data collections
89-
dcgs = [
90-
{
91-
"sessionId": bl_session_id,
92-
"experimentTypeId": ISPyBTableValues.experiment_types.get(name),
93-
}
94-
for name, id in ISPyBTableValues.experiment_types.items()
95-
]
96-
dcg_entries = [DataCollectionGroup(**dcg) for dcg in dcgs]
97-
for entry in dcg_entries:
98-
ispyb_db_session.add(entry)
99-
ispyb_db_session.commit()
100-
101-
# Test the function
102-
results = get_data_collection_group_ids(
103-
session_id=bl_session_id,
104-
)
105-
assert len(results) == len(dcg_entries)

0 commit comments

Comments
 (0)