argilla-io / argilla

Argilla is a collaboration tool for AI engineers and domain experts to build high-quality datasets
https://docs.argilla.io
Apache License 2.0
3.98k stars 377 forks source link

[BUG-UI/UX] discarding records wrongly updates n_record counter during applied filters #4389

Closed davidberenstein1957 closed 11 months ago

davidberenstein1957 commented 11 months ago

Describe the bug discarding records wrongly updates n_record counter during applied filters

To Reproduce Steps to reproduce the behavior:

  1. Go to a dataset
  2. apply filters
  3. look at the counter
  4. discard records

Expected behavior I would expect the record counter to be updated properly-

Screenshots image

Environment (please complete the following information):

Additional context N.A.

dosubot[bot] commented 11 months ago

🤖

Hey there, @davidberenstein1957! 🚀 I'm Dosu, your friendly neighborhood bot. I'm here to help you navigate the world of bugs, answer your questions, and even guide you on your journey to becoming a contributor. While we're waiting for a human maintainer, don't hesitate to ask me anything. Let's get this sorted out together! 👩‍💻👨‍💻

Thank you for reporting this issue. Based on the current logic of the Argilla codebase, the n_record counter is updated based on the number of records in the dataset. This count is fetched from the server side and is not directly manipulated in the client code.

When filters are applied, the __len__ method in the RemoteFeedbackRecords class fetches the records with the applied filters and returns the total number of records. If there are no filters, it retrieves the metrics of the dataset and returns the count of records. Here is the relevant code:

@allowed_for_roles(roles=[UserRole.owner, UserRole.admin])
def __len__(self) -> int:
    """Returns the number of records in the current `FeedbackDataset` in Argilla."""
    try:
        if self._has_filters():
            return self._fetch_records(offset=0, limit=1).total
        else:
            response = datasets_api_v1.get_metrics(client=self._client, id=self._dataset.id).parsed
            return response.records.count
    except Exception as e:
        raise Exception(
            f"Failed while getting the metrics from the current `FeedbackDataset` in Argilla with exception: {e}"
        ) from e

You can find this code in the src/argilla/client/feedback/dataset/remote/dataset.py file.

As for the discard method you mentioned, it seems there might be some confusion. In the current Argilla codebase, discard is not a method but an SVG icon definition used in the Vue.js application. You can find this in the frontend/assets/icons/discard.js file.

If you are referring to a different discard method, could you please provide more details or point to the specific part of the codebase where this method is defined? This will help us better understand and address the issue you're facing.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.