Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • baserow baserow
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 561
    • Issues 561
    • List
    • Boards
    • Service Desk
    • Milestones
    • Requirements
  • Merge requests 21
    • Merge requests 21
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Baserow
  • baserowbaserow
  • Issues
  • #1609
Closed
Open
Issue created Mar 01, 2023 by Alexander Haller@alex1431999🙂Developer

Get previous adjacent row doesn't work without view specified

Describe the problem

When running RowHandler.get_adjacent_row with previous=True and no view specified, the function will always return the first row in the table.

Steps to reproduce

Add this test to your test_rows_handler.py and see the last assert failing.

@pytest.mark.django_db
def test_get_adjacent_row_no_view(data_fixture):
    user = data_fixture.create_user()
    table = data_fixture.create_database_table(user=user)

    name_field = data_fixture.create_text_field(
        table=table, name="Name", text_default="Test"
    )

    handler = RowHandler()
    [row_1, row_2, row_3, row_4, row_5, row_6] = handler.create_rows(
        user=user,
        table=table,
        rows_values=[
            {
                f"field_{name_field.id}": "A",
            },
            {
                f"field_{name_field.id}": "B",
            },
            {
                f"field_{name_field.id}": "C",
            },
            {
                f"field_{name_field.id}": "D",
            },
            {
                f"field_{name_field.id}": "E",
            },
            {
                f"field_{name_field.id}": "F",
            },
        ],
    )

    base_queryset = table.get_model().objects.all()

    assert handler.get_adjacent_row(row_4, base_queryset).id == row_5.id
    assert handler.get_adjacent_row(row_4, base_queryset, previous=True).id == row_3.id

Actual result

It will return the first row of the table.

Expected result

It should return the previous row of the row specified.

Environment

  • Operating System: Windows/Ubuntu/Mac/etc.
  • Web Browser: Chrome / Firefox / Edge / Safari
  • Deployment Type: baserow.io / docker / cloudron / ubuntu with supervisor / heroku / other
  • Baserow Version: Develop / 1.8 / 1.7 / 1.6 etc
Assignee
Assign to
Time tracking