Skip to content

Commit

Permalink
fixing one issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kylevillegas93 committed Oct 29, 2024
1 parent 59e3a8d commit 9a6ccea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion processes/frbr/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ def classify_records(self, full=False, start_date_time=None):

if len(frbrized_records) >= window_size:
self.classified_count += len(frbrized_records)

self.bulkSaveObjects(frbrized_records)

frbrized_records = []

if len(frbrized_records):
self.classified_count += len(frbrized_records)
self.bulkSaveObjects(frbrized_records)

def frbrize_record(self, record: Record):
queryable_ids = self._get_queryable_identifiers(record.identifiers)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/processes/frbr/test_classify_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_classify_records_full(self, test_instance, mocker):
mock_start_time.timedelta.assert_not_called()
mock_window_query.assert_called_once()
mock_frbrize_record.assert_has_calls([mocker.call(record) for record in mock_records[:50]])
mock_bulk_save_objects.assert_not_called()
mock_bulk_save_objects.assert_called_once()

def test_classify_records_full_batch(self, test_instance, mocker):
mock_frbrize_record = mocker.patch.object(ClassifyProcess, 'frbrize_record')
Expand Down

0 comments on commit 9a6ccea

Please sign in to comment.