Skip to content

[BUG] CSV Export Contains Empty Goal Fields Due to Schema Mismatch #2511

@Namraa310806

Description

@Namraa310806

Bug Description

The CSV export implementation expects goal fields that are not included in the goals query, resulting in empty columns in exported CSV files.

The goals query currently selects:

  • id
  • user_id
  • title
  • description
  • status
  • created_at
  • updated_at

However, the CSV export generates headers for:

  • target
  • current
  • unit
  • recurrence
  • deadline

Since these fields are not present in the fetched goal objects, the exported CSV contains empty values for those columns.

Expected Behavior:
CSV exports should either:

  1. Include the required fields in the database query, or
  2. Remove outdated/non-existent columns from the CSV header definition.

Current Behavior:
CSV files contain empty columns that suggest data exists when it is never actually exported.

Steps to Reproduce

  1. Sign in to DevTrack.

  2. Navigate to the data export functionality.

  3. Request a CSV export (?format=csv).

  4. Open the generated CSV file.

  5. Observe that the columns:

    • target
    • current
    • unit
    • recurrence
    • deadline

    are present in the header row but contain empty values for all records.

Affected Area

Other

Screenshots

No response

Browser & OS

No response

Environment

None

Additional Context

Relevant code sections:

Goals Query:
.select("id, user_id, title, description, status, created_at, updated_at")

CSV Headers:
const headers = [
"id",
"title",
"target",
"current",
"unit",
"recurrence",
"deadline",
"created_at"
];

Potential Fixes:

  • Update the goals query to fetch the missing fields if they exist in the schema.
  • Or remove obsolete fields from the CSV export header definition.

Impact:
Users receive incomplete or misleading CSV exports, and the CSV format becomes inconsistent with the underlying exported data.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggssoc:assignedGSSoC: Issue assigned to a contributorneeds-triageNeeds maintainer triage

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions