Skip to content

Commit

Permalink
Merge pull request #129 from JunAishima/fix-lbms-issues
Browse files Browse the repository at this point in the history
fix missing facility specification
  • Loading branch information
stuartcampbell authored Jan 10, 2025
2 parents b627872 + 8b068ce commit e12eade
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit e12eade

Please sign in to comment.