# Bug OP-14784 - Unnecessary journal created changing total % complete from 0 to null during progress migration

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 14.0.0 |
| Observed in versions |  |
| Sprint | 14.0.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee | Markus Kahl |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

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

## Costs

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

## Description

This is related to <mention class="mention" data-id="40749" data-type="work_package" data-text="#40749">\#40749</mention> 

### Steps to reproduce

1.  Have a 13.4 instance
2.  Be in work-based mode (Admin -\> Work packages -\> Settings -\> Calculate the work package % complete with == Use the work package field
3.  Create a work package with work and remaining work being unset (which should be the default)
4.  Migrate to (soon-to-be-released) 14.0
5.  Go and see the work package activity thread

### What is the buggy behavior?

  - There is an activity item by the System user because the total % complete has been changed from 0 to null, due to the way progress calculations now work: total work and total remaining work are unset, so total % complete is unset too.
  - This is an invisible and uninteresting change which is not worth showing: no journal should be created for that

### What is the expected behavior?

1.  No journal should be created for this one

One way to avoid creating journals for total % complete changed from 0% to unset is to unset it in previous journals before actually migrating the data. If it's unset, there will be no actual modifications after the progress migration calculations have run, and no journal will be created. It will be faster and leaner.

### Acceptance criteria

Field `derived_done_ratio` (the db field for total % complete) was introduced in `db/migrate/20240116165933_add_derived_done_ratio_to_work_packages.rb`.

It should be reset to NULL in work packages and their journals. This way, it's like the field had just been introduced and the value has been set by the migration. All previously computed values were incorrect anyway (old computation method)
