# Bug OP-17487 - NoMethodError in  TimeEntriesController

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-17487

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Time tracking |
| Target versions | 16.3.0 |
| Observed in versions | 16.2.0 |
| Sprint | 16.3.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 16.2.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Klaus Zanders |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

Detected through AppSignal

1.  Ensure you can enter start and end time when logging time
    
    1.  Administration / Time and Costs / Defaults, check &quot;Allow start and finish times&quot;
        
2.  From my time tracking, in list view, open log time modal by creating a new entry
    
3.  Fill the start time. **Do not fill &quot;End time&quot; or &quot;hours&quot; fields.**
    
4.  Pick any work package
    

### What is the buggy behavior?

Internal Server error

<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/725239/content">

### What is the expected behavior?

No application error (HTTP 500)

###   

### **Logs**

*   AppSignal links:
    
    *   [https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/1038](https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/1038)
        
    *   [https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/1039](https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/1039)
        

#### Backtrace 1

```text
undefined method 'hours' for nil

modules/costs/app/models/time_entry.rb:171 TimeEntry#end_timestamp
modules/costs/app/components/time_entries/days_and_hours_form.rb:90 TimeEntries::DaysAndHoursForm#end_time_in_local_time
modules/costs/app/components/time_entries/days_and_hours_form.rb:63 block (2 levels) in <class:DaysAndHoursForm>
modules/costs/app/components/time_entries/days_and_hours_form.rb:47 block in <class:DaysAndHoursForm>
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:36 block (4 levels) in TimeEntries::TimeEntryFormComponent#call
app/components/op_primer/component_helpers.rb:32 OpPrimer::ComponentHelpers#flex_layout
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:32 block (2 levels) in TimeEntries::TimeEntryFormComponent#call
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:31 block in TimeEntries::TimeEntryFormComponent#call
app/components/concerns/op_turbo/streamable.rb:109 TimeEntries::TimeEntryFormComponent#component_wrapper
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:30 TimeEntries::TimeEntryFormComponent#call
app/components/concerns/op_turbo/streamable.rb:54 TimeEntries::TimeEntryFormComponent#render_as_turbo_stream
app/controllers/concerns/op_turbo/component_stream.rb:59 OpTurbo::ComponentStream#modify_via_turbo_stream
app/controllers/concerns/op_turbo/component_stream.rb:50 OpTurbo::ComponentStream#replace_via_turbo_stream
modules/costs/app/controllers/time_entries_controller.rb:78 TimeEntriesController#refresh_form
```

#### Backtrace 2

```text
undefined method 'hours' for nil

modules/costs/app/models/time_entry.rb:171 TimeEntry#end_timestamp
modules/costs/app/components/time_entries/days_and_hours_form.rb:90 TimeEntries::DaysAndHoursForm#end_time_in_local_time
modules/costs/app/components/time_entries/days_and_hours_form.rb:63 block (2 levels) in <class:DaysAndHoursForm>
modules/costs/app/components/time_entries/days_and_hours_form.rb:47 block in <class:DaysAndHoursForm>
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:36 block (4 levels) in TimeEntries::TimeEntryFormComponent#call
app/components/op_primer/component_helpers.rb:32 OpPrimer::ComponentHelpers#flex_layout
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:32 block (2 levels) in TimeEntries::TimeEntryFormComponent#call
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:31 block in TimeEntries::TimeEntryFormComponent#call
app/components/concerns/op_turbo/streamable.rb:105 TimeEntries::TimeEntryFormComponent#component_wrapper
modules/costs/app/components/time_entries/time_entry_form_component.html.erb:30 TimeEntries::TimeEntryFormComponent#call
app/components/concerns/op_turbo/streamable.rb:52 TimeEntries::TimeEntryFormComponent#render_as_turbo_stream
app/controllers/concerns/op_turbo/component_stream.rb:59 OpTurbo::ComponentStream#modify_via_turbo_stream
app/controllers/concerns/op_turbo/component_stream.rb:46 OpTurbo::ComponentStream#update_via_turbo_stream
modules/costs/app/controllers/time_entries_controller.rb:96 TimeEntriesController#create
```
