code4romania / code4romania/bursa-binelui
Bug: `start_date` or `end_date` is `null` in the database, causing 500 error on project page
- Dominant language
- PHP
- Stars
- 5
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
### Description
We've encountered a case where the `start_date` or `end_date` field in the `Project` model is `null` in the database. This causes a `500 Internal Server Error` on the project detail page in the frontend when attempting to render the project.
---
### ✅ Proposed Actions
1. **Add a fallback** in the frontend/backend to handle cases where `start_date` or `end_date` is `null`, to avoid runtime errors.
2. **Investigate the root cause** of these fields being saved as `null`.
- `null` values should only be allowed for projects in **draft** status.
- For projects that are **published** or **active**, both `start_date` and `end_date` should be **required** and properly validated.
---
### ✅ Expected Behavior
- Projects in **draft** status: may have missing (`null`) date fields.
- Projects in **published/active** status: must have valid `start_date` and `end_date`.
- Application must **not crash** due to missing date fields.
---
### 💥 Impact
This issue causes the frontend to break with a `500` error, impacting user access to project pages and overall app stability.
---
### 📝 Additional Notes
- Consider checking validation at both the **model** and **serializer/form** level.
- Review any migrations or data input sources that may allow saving projects without these fields.
Contributor guide
Research direction
Review the Project model, serializer/form validation, migrations, and data input sources to trace how null start_date or end_date values reach published or active projects. Then inspect the frontend project detail page handling of missing dates. Done means drafts may omit dates, published or active projects require both valid fields, and the page no longer returns a 500 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100