Skip to content

Commit

Permalink
chore: rename submitted_responses to responses_submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcalvo committed Jun 28, 2024
1 parent e1d80eb commit 312dc16
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion argilla-server/src/argilla_server/bulk/records_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ async def _preload_records_relationships_before_index(db: "AsyncSession", record
.filter(Record.id.in_([record.id for record in records]))
.options(
selectinload(Record.responses).selectinload(Response.user),
selectinload(Record.submitted_responses),
selectinload(Record.responses_submitted),
selectinload(Record.suggestions).selectinload(Suggestion.question),
selectinload(Record.vectors),
)
Expand Down
8 changes: 4 additions & 4 deletions argilla-server/src/argilla_server/contexts/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ async def create_response(
await db.flush([response])
await _touch_dataset_last_activity_at(db, record.dataset)
await search_engine.update_record_response(response)
await db.refresh(record, attribute_names=[Record.submitted_responses.key])
await db.refresh(record, attribute_names=[Record.responses_submitted.key])
await distribution.update_record_status(db, record, autocommit=False)
await search_engine.partial_record_update(record, status=record.status)

Expand All @@ -964,7 +964,7 @@ async def update_response(
await _load_users_from_responses(response)
await _touch_dataset_last_activity_at(db, response.record.dataset)
await search_engine.update_record_response(response)
await db.refresh(response.record, attribute_names=[Record.submitted_responses.key])
await db.refresh(response.record, attribute_names=[Record.responses_submitted.key])
await distribution.update_record_status(db, response.record, autocommit=False)
await search_engine.partial_record_update(response.record, status=response.record.status)

Expand Down Expand Up @@ -996,7 +996,7 @@ async def upsert_response(
await _load_users_from_responses(response)
await _touch_dataset_last_activity_at(db, response.record.dataset)
await search_engine.update_record_response(response)
await db.refresh(record, attribute_names=[Record.submitted_responses.key])
await db.refresh(record, attribute_names=[Record.responses_submitted.key])
await distribution.update_record_status(db, record, autocommit=False)
await search_engine.partial_record_update(record, status=record.status)

Expand All @@ -1012,7 +1012,7 @@ async def delete_response(db: AsyncSession, search_engine: SearchEngine, respons
await _load_users_from_responses(response)
await _touch_dataset_last_activity_at(db, response.record.dataset)
await search_engine.delete_record_response(response)
await db.refresh(response.record, attribute_names=[Record.submitted_responses.key])
await db.refresh(response.record, attribute_names=[Record.responses_submitted.key])
await distribution.update_record_status(db, response.record, autocommit=False)
await search_engine.partial_record_update(record=response.record, status=response.record.status)

Expand Down
2 changes: 1 addition & 1 deletion argilla-server/src/argilla_server/contexts/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def update_record_status(db: AsyncSession, record: Record, autocommit: boo


async def _update_record_status_with_overlap_strategy(db: AsyncSession, record: Record, autocommit: bool) -> Record:
if len(record.submitted_responses) >= record.dataset.distribution["min_submitted"]:
if len(record.responses_submitted) >= record.dataset.distribution["min_submitted"]:
record.status = RecordStatus.completed
else:
record.status = RecordStatus.pending
Expand Down
2 changes: 1 addition & 1 deletion argilla-server/src/argilla_server/models/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class Record(DatabaseModel):
passive_deletes=True,
order_by=Response.inserted_at.asc(),
)
submitted_responses: Mapped[List["Response"]] = relationship(
responses_submitted: Mapped[List["Response"]] = relationship(
back_populates="record",
cascade="all, delete-orphan",
passive_deletes=True,
Expand Down
2 changes: 1 addition & 1 deletion argilla-server/tests/unit/search_engine/test_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ async def refresh_records(records: List[Record]):
for record in records:
await record.awaitable_attrs.suggestions
await record.awaitable_attrs.responses
await record.awaitable_attrs.submitted_responses
await record.awaitable_attrs.responses_submitted
await record.awaitable_attrs.vectors


Expand Down

0 comments on commit 312dc16

Please sign in to comment.