roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Download plan as csv records export twice

Open nicolasfranck opened this issue 1 year ago • 1 comments

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

3.1.1

Expected behaviour:

When I download my plan as csv, that should only be recorded once

Actual behaviour:

When I download my plan as csv, it is recorded twice

Possible cause:

  • Plan#record_plan_export records every plan export
  • Every call to Plan#prepare calls that record_plan_export
  • PlanExportsController#show calls Plan#as_pdf which calls prepare and so records plan export. Almost every export format uses the returned @hash
  • the csv export is the only place where that @hash is NOT used. Plan#as_csv also calls prepare so download is recorded twice.

Maybe call this method Plan#record_plan_export more explicitly in the client code, in order to prevent this kind of issues?

nicolasfranck avatar Aug 03 '22 07:08 nicolasfranck