Skip to content

fix missing facility specification #129

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 3 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nsls2api/services/pass_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ async def get_proposals_allocated_by_cycle(
logger.error(error_message)
raise PassException(error_message)

cycle = await Cycle.find_one(Cycle.name == cycle_name)
cycle = await Cycle.find_one(Cycle.name == cycle_name, Cycle.facility == facility)
if not cycle:
error_message: str = f"Could not find a cycle with the name {cycle_name}."
logger.error(error_message)
Expand Down
4 changes: 2 additions & 2 deletions src/nsls2api/services/sync_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async def worker_synchronize_cycles_from_pass(
pass_id=str(pass_cycle.ID),
)

updated_cycle = await Cycle.find_one(Cycle.name == pass_cycle.Name).upsert(
updated_cycle = await Cycle.find_one(Cycle.name == pass_cycle.Name, Cycle.facility == facility.facility_name).upsert(
Set(
{
Cycle.accepting_proposals: cycle.accepting_proposals,
Expand All @@ -132,7 +132,7 @@ async def worker_synchronize_cycles_from_pass(
)

# Now let's update the list of proposals for this cycle
proposals_list = await pass_service.get_proposals_allocated_by_cycle(cycle.name)
proposals_list = await pass_service.get_proposals_allocated_by_cycle(cycle.name, facility=facility_name)
for proposal in proposals_list:
await updated_cycle.update(
AddToSet({Cycle.proposals: str(proposal.Proposal_ID)})
Expand Down
Loading