Skip to content

Commit

Permalink
fix: don't mix created and birth dates on exports
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed May 27, 2024
1 parent 2770424 commit 71a6087
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ Shown In Export
Should Be Equal ${root.tag} gkxml

${first_gk} = Get Element ${root} geokret
${datecreated} = Get Element ${first_gk} datecreated
XML.Element Text Should Be ${datecreated} ${expected}
${birthdate} = Get Element ${first_gk} birthdate
XML.Element Text Should Be ${birthdate} ${expected}


Shown In Export2
Expand Down Expand Up @@ -225,8 +225,8 @@ Shown In Export2Details

${first_gk} = Get Element ${root} geokrety/geokret

${datecreated} = Get Element ${first_gk} datecreated
XML.Element Text Should Be ${datecreated} ${expected}
${birthdate} = Get Element ${first_gk} birthdate
XML.Element Text Should Be ${birthdate} ${expected}


*** Keywords ***
Expand Down
7 changes: 5 additions & 2 deletions website/app/GeoKrety/Service/Xml/GeokretyExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ public function addGeokret(Geokret &$geokret) {
$xml->endElement(); // owner
}

$xml->writeElement('datecreated', $geokret->born_on_datetime->format('Y-m-d H:i:s'));
$xml->writeElement('datecreated_Iso8601', $geokret->born_on_datetime->format(\DateTime::ATOM));
$xml->writeElement('birthdate', $geokret->born_on_datetime->format('Y-m-d H:i:s'));
$xml->writeElement('birthdate_Iso8601', $geokret->born_on_datetime->format(\DateTime::ATOM));

$xml->writeElement('datecreated', $geokret->created_on_datetime->format('Y-m-d H:i:s'));
$xml->writeElement('datecreated_Iso8601', $geokret->created_on_datetime->format(\DateTime::ATOM));

$xml->writeElement('distancetravelled', $geokret->distance);
$xml->writeAttribute('note', 'legacy bug compatibility');
Expand Down
10 changes: 9 additions & 1 deletion website/app/GeoKrety/Service/Xml/GeokretyExport2Details.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ public function addGeokret(Geokret &$geokret) {
}

$xml->startElement('datecreated');
$xml->writeCData($geokret->born_on_datetime->format('Y-m-d H:i:s'));
$xml->writeCData($geokret->created_on_datetime->format('Y-m-d H:i:s'));
$xml->endElement(); // datecreated

$xml->startElement('datecreated_Iso8601');
$xml->writeCData($geokret->created_on_datetime->format(\DateTimeInterface::ATOM));
$xml->endElement(); // datecreated_Iso8601

$xml->startElement('birthdate');
$xml->writeCData($geokret->born_on_datetime->format('Y-m-d H:i:s'));
$xml->endElement(); // birthdate

$xml->startElement('birthdate_Iso8601');
$xml->writeCData($geokret->born_on_datetime->format(\DateTimeInterface::ATOM));
$xml->endElement(); // birthdate_Iso8601

$xml->startElement('dateupdated');
$xml->writeCData($geokret->updated_on_datetime->format('Y-m-d H:i:s'));
$xml->endElement(); // dateupdated
Expand Down

0 comments on commit 71a6087

Please sign in to comment.