Skip to content

Commit

Permalink
feat: altered the edit and view pages to load the new structure of th…
Browse files Browse the repository at this point in the history
…e suggested changes

View and edit pages now use a separate curator copy of suggested changes so as to allow further modifications.
  • Loading branch information
sriramkanakam87 committed Oct 2, 2024
1 parent 97a11db commit 0f2acbe
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,66 @@ class EditReport extends EditRecord

protected function mutateFormDataBeforeFill(array $data): array
{
$data['organisms_changes'] = $data['suggested_changes']['organisms_changes'];
$data['geo_locations_changes'] = $data['suggested_changes']['geo_locations_changes'];
$data['synonyms_changes'] = $data['suggested_changes']['synonyms_changes'];
$data['identifiers_changes'] = $data['suggested_changes']['identifiers_changes'];
$data['citations_changes'] = $data['suggested_changes']['citations_changes'];
if ($data['is_change'] == true) {
$curators_copy_changes = $data['suggested_changes']['curator'];
$data['existing_geo_locations'] = $curators_copy_changes['existing_geo_locations'];
$data['new_geo_locations'] = $curators_copy_changes['new_geo_locations'];
$data['approve_geo_locations'] = $curators_copy_changes['approve_geo_locations'];

$data['existing_synonyms'] = $curators_copy_changes['existing_synonyms'];
$data['new_synonyms'] = $curators_copy_changes['new_synonyms'];
$data['approve_synonyms'] = $curators_copy_changes['approve_synonyms'];

$data['name'] = $curators_copy_changes['name'];
$data['approve_name'] = $curators_copy_changes['approve_name'];

$data['existing_cas'] = $curators_copy_changes['existing_cas'];
$data['new_cas'] = $curators_copy_changes['new_cas'];
$data['approve_cas'] = $curators_copy_changes['approve_cas'];

$data['existing_organisms'] = $curators_copy_changes['existing_organisms'];
$data['approve_existing_organisms'] = $curators_copy_changes['approve_existing_organisms'];

$data['new_organisms'] = $curators_copy_changes['new_organisms'];

$data['existing_citations'] = $curators_copy_changes['existing_citations'];
$data['approve_existing_citations'] = $curators_copy_changes['approve_existing_citations'];

$data['new_citations'] = $curators_copy_changes['new_citations'];
}

return $data;
}

protected function mutateFormDataBeforeSave(array $data): array
{
if ($data['is_change'] == true) {
$data['suggested_changes']['curator']['existing_geo_locations'] = $data['existing_geo_locations'];
$data['suggested_changes']['curator']['new_geo_locations'] = $data['new_geo_locations'];
$data['suggested_changes']['curator']['approve_geo_locations'] = $data['approve_geo_locations'];

$data['suggested_changes']['curator']['existing_synonyms'] = $data['existing_synonyms'];
$data['suggested_changes']['curator']['new_synonyms'] = $data['new_synonyms'];
$data['suggested_changes']['curator']['approve_synonyms'] = $data['approve_synonyms'];

$data['suggested_changes']['curator']['name'] = $data['name'];
$data['suggested_changes']['curator']['approve_name'] = $data['approve_name'];

$data['suggested_changes']['curator']['existing_cas'] = $data['existing_cas'];
$data['suggested_changes']['curator']['new_cas'] = $data['new_cas'];
$data['suggested_changes']['curator']['approve_cas'] = $data['approve_cas'];

$data['suggested_changes']['curator']['existing_organisms'] = $data['existing_organisms'];
$data['suggested_changes']['curator']['approve_existing_organisms'] = $data['approve_existing_organisms'];

$data['suggested_changes']['curator']['new_organisms'] = $data['new_organisms'];

$data['suggested_changes']['curator']['existing_citations'] = $data['existing_citations'];
$data['suggested_changes']['curator']['approve_existing_citations'] = $data['approve_existing_citations'];

$data['suggested_changes']['curator']['new_citations'] = $data['new_citations'];

}

return $data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,33 @@ class ViewReport extends ViewRecord

protected function mutateFormDataBeforeFill(array $data): array
{
$data['organisms_changes'] = $data['suggested_changes']['organisms_changes'];
$data['geo_locations_changes'] = $data['suggested_changes']['geo_locations_changes'];
$data['synonyms_changes'] = $data['suggested_changes']['synonyms_changes'];
$data['identifiers_changes'] = $data['suggested_changes']['identifiers_changes'];
$data['citations_changes'] = $data['suggested_changes']['citations_changes'];
if ($data['is_change'] == true) {
$curators_copy_changes = $data['suggested_changes']['curator'];
$data['existing_geo_locations'] = $curators_copy_changes['existing_geo_locations'];
$data['new_geo_locations'] = $curators_copy_changes['new_geo_locations'];
$data['approve_geo_locations'] = $curators_copy_changes['approve_geo_locations'];

$data['existing_synonyms'] = $curators_copy_changes['existing_synonyms'];
$data['new_synonyms'] = $curators_copy_changes['new_synonyms'];
$data['approve_synonyms'] = $curators_copy_changes['approve_synonyms'];

$data['name'] = $curators_copy_changes['name'];
$data['approve_name'] = $curators_copy_changes['approve_name'];

$data['existing_cas'] = $curators_copy_changes['existing_cas'];
$data['new_cas'] = $curators_copy_changes['new_cas'];
$data['approve_cas'] = $curators_copy_changes['approve_cas'];

$data['existing_organisms'] = $curators_copy_changes['existing_organisms'];
$data['approve_existing_organisms'] = $curators_copy_changes['approve_existing_organisms'];

$data['new_organisms'] = $curators_copy_changes['new_organisms'];

$data['existing_citations'] = $curators_copy_changes['existing_citations'];
$data['approve_existing_citations'] = $curators_copy_changes['approve_existing_citations'];

$data['new_citations'] = $curators_copy_changes['new_citations'];
}

return $data;
}
Expand Down

0 comments on commit 0f2acbe

Please sign in to comment.