Skip to content

Commit

Permalink
⚡️ Fix issue (#5238)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianpumar authored Jul 16, 2024
1 parent a263887 commit a7329a6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default {
},
computed: {
spanQuestionsAnswers() {
return this.record.questions
return this.record?.questions
.filter((q) => q.isSpanType)
.map((q) => ({
id: q.id,
Expand All @@ -60,7 +60,7 @@ export default {
deep: true,
handler() {
if (
this.record.questions
this.record?.questions
.filter((q) => q.isSpanType)
.some((q) => q.isModified)
) {
Expand Down
8 changes: 2 additions & 6 deletions argilla-frontend/v1/domain/entities/record/Records.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1119,11 +1119,7 @@ describe("Records", () => {
describe("EmptyQueueRecords", () => {
describe("hasRecordsToAnnotate", () => {
test("should be false always", () => {
const records = new EmptyQueueRecords(
createBasicRecordCriteria(),
20,
[]
);
const records = new EmptyQueueRecords(createBasicRecordCriteria(), []);

const hasRecordsToAnnotate = records.hasRecordsToAnnotate;

Expand All @@ -1134,7 +1130,7 @@ describe("EmptyQueueRecords", () => {
describe("getRecordOn", () => {
test("always should return the record configured by record criteria", () => {
const recordCriteria = createBasicRecordCriteria();
const records = new EmptyQueueRecords(recordCriteria, 20, []);
const records = new EmptyQueueRecords(recordCriteria, []);

const hasRecordsToAnnotate = records.getRecordOn(recordCriteria.page);

Expand Down
8 changes: 2 additions & 6 deletions argilla-frontend/v1/domain/entities/record/Records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,7 @@ export class RecordsWithReference extends Records {
}

export class EmptyQueueRecords extends Records {
constructor(
criteria: RecordCriteria,
total: number,
questions: Question[] = []
) {
constructor(criteria: RecordCriteria, questions: Question[] = []) {
const nullRecord = new Record(
undefined,
criteria.datasetId,
Expand All @@ -151,6 +147,6 @@ export class EmptyQueueRecords extends Records {
null
);

super([nullRecord], total, false);
super([nullRecord], -1, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class GetRecordsByCriteriaUseCase {
if (recordsFromBackend.records.length === 0) {
return new EmptyQueueRecords(
criteria,
recordsFromBackend.total,
questionsFromBackend.map((question) => {
return new Question(
question.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class LoadRecordsToAnnotateUseCase {
if (!isFilteringBySimilarity && !isNextRecordExist) {
const newRecords = await this.getRecords.execute(criteria);

records.append(newRecords);
if (newRecords.hasRecordsToAnnotate) records.append(newRecords);

isNextRecordExist = records.existsRecordOn(page);

Expand Down

0 comments on commit a7329a6

Please sign in to comment.