Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Missing Template Error: Update ecoscore_details.tt.html to environmental_score_details.tt.html #11505

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

JagjeevanAK
Copy link
Contributor

@JagjeevanAK JagjeevanAK commented Mar 1, 2025

What

This PR updates references to ecoscore_details.tt.html, which was renamed as part of an earlier commit #11142, to the new file name environmental_score_details.tt.html.

Issue Fixed

The website was displaying an error on this page: https://world.openfoodfacts.org/cgi/product_image.pl?code=8033028910213&id=front_en

file error - web/pages/product/includes/environmental_score_details.tt.html: not found

This happened because:

  • The ecoscore_details.tt.html template was renamed to environmental_score_details.tt.html as part of the Eco-Score transition.
  • Some parts of the code (Perl controllers, config files, or dynamic includes) were still trying to reference the old filename.

Changes Made

  • Updated all occurrences of ecoscore_details.tt.html to environmental_score_details.tt.html in:
    • Template files (.tt.html)
  • Also checked below file for occurrences of ecoscore_details.tt.html but there was no such thing present,.
    • Perl controllers (.pm)
    • Configurations (.conf, .json, .yml, etc.)
  • Verified that the [% INCLUDE ... %] statements correctly reference the new template.
  • Restarted the web server locally to confirm the fix.

Feature required changes

  • If any frontend dependencies reference ecoscore_details.tt.html, they may need updates as well.
  • This PR does not rename database fields or API endpoints—only the template reference.

This should be good for submission! Let me know if you need refinements. 🚀

``

Screenshot

Original

Screenshot 2025-03-01 at 11 59 14 AM

Updated change

Screenshot 2025-03-01 at 12 02 20 PM

Related issue(s) and discussion

#11142: Rename Eco-Score fields to Environmental Score

I above issue there was about renaming of ecoscore to environmental_score by stephanegigandet but file names in templates was not made.

If there is an issue in my Pull request then I am open to make necessary changes to it.

@JagjeevanAK JagjeevanAK requested a review from a team as a code owner March 1, 2025 06:41
@github-actions github-actions bot added the Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. label Mar 1, 2025
@JagjeevanAK JagjeevanAK changed the title #11277 issue: Fix Missing Template Error: Update ecoscore_details.tt.html to environmental_score_details.tt.html fix: Fix Missing Template Error: Update ecoscore_details.tt.html to environmental_score_details.tt.html #11277 Mar 1, 2025
@JagjeevanAK JagjeevanAK changed the title fix: Fix Missing Template Error: Update ecoscore_details.tt.html to environmental_score_details.tt.html #11277 fix: Fix Missing Template Error: Update ecoscore_details.tt.html to environmental_score_details.tt.html Mar 1, 2025
@JagjeevanAK JagjeevanAK changed the title fix: Fix Missing Template Error: Update ecoscore_details.tt.html to environmental_score_details.tt.html fix: Missing Template Error: Update ecoscore_details.tt.html to environmental_score_details.tt.html Mar 1, 2025
Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@stephanegigandet stephanegigandet enabled auto-merge (squash) March 3, 2025 17:14
@teolemon
Copy link
Member

teolemon commented Mar 3, 2025

@stephanegigandet is there a way to check globally for missing includes in templates ? Wouldn't that be a great test to write ?

@codecov-commenter
Copy link

codecov-commenter commented Mar 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.86%. Comparing base (3c5ec4a) to head (5a41893).
Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11505   +/-   ##
=======================================
  Coverage   49.85%   49.86%           
=======================================
  Files          83       83           
  Lines       22964    22964           
  Branches     5501     5501           
=======================================
+ Hits        11449    11450    +1     
  Misses      10121    10121           
+ Partials     1394     1393    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JagjeevanAK
Copy link
Contributor Author

Can anyone help me to know why was this job failed ?? I am seeing there was the issue of cache issue ??. @alexgarel

@stephanegigandet
Copy link
Contributor

Can anyone help me to know why was this job failed ?? I am seeing there was the issue of cache issue ??. @alexgarel

@JagjeevanAK you can look at the details of the failed test, and in the log search for "fail":

https://github.com/openfoodfacts/openfoodfacts-server/actions/runs/13636572520/job/38119624091?pr=11505#step:8:24537

This is because your PR changes the HTML output on some pages (which in this case is a good thing: it removes the error message).

You can run "make update_tests_results" to update the tests results locally.

or /update_tests_results in a GitHub comment

@stephanegigandet
Copy link
Contributor

/update_tests_results

@alexgarel
Copy link
Member

@stephanegigandet /update_tests_results does not work when this is a PR from a forked repository…
Maybe because it's @JagjeevanAK who needs to issue it ?

@JagjeevanAK
Copy link
Contributor Author

JagjeevanAK commented Mar 4, 2025

/update_tests_results does not work for PRs from forked repositories. Since this PR is from my fork, I need to manually update the test results. I'll run make update_tests_results locally and push the changes.

auto-merge was automatically disabled March 4, 2025 14:44

Head branch was pushed to by a user without write access

@github-actions github-actions bot added API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) 📚 Documentation Documentation issues improve the project for everyone. 🧪 tests 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels 🧪 integration tests labels Mar 4, 2025
Copy link
Contributor Author

@JagjeevanAK JagjeevanAK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file change it was by mistake. which has already been committed in other PR.

@JagjeevanAK
Copy link
Contributor Author

Still having issue don't how to overcome it will look at the logs.

@stephanegigandet
Copy link
Contributor

For some reason the port is different:

(  DIAG  )  job  9    | PATH                 | GOT                  | OP | CHECK                |
(  DIAG  )  job  9    +----------------------+----------------------+----+----------------------+
(  DIAG  )  job  9    | {data_quality_errors | http://static.openfo/ | eq | http://static.openfo/ |
(  DIAG  )  job  9    | }{title_element}{ico | odfacts.localhost/im |    | odfacts.localhost:80 |
(  DIAG  )  job  9    | n_url}               | ages/icons/dist/data |    | 80/images/icons/dist |
(  DIAG  )  job  9    |                      | -error.svg           |    | /data-error.svg

@stephanegigandet
Copy link
Contributor

@JagjeevanAK did you do something specific to change the port from 80 to 8080? or maybe it's done on MacOS

@JagjeevanAK
Copy link
Contributor Author

JagjeevanAK commented Mar 5, 2025

Sir, It was just for my convenience should I re run the test and push again with port 80 ?

@JagjeevanAK JagjeevanAK force-pushed the JagjeevanAK/issue11277- branch from 4952997 to 5a41893 Compare March 5, 2025 16:04
@JagjeevanAK
Copy link
Contributor Author

@stephanegigandet can you help me to resolve this failed test issue ?

Copy link

sonarqubecloud bot commented Mar 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
14.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) 📚 Documentation Documentation issues improve the project for everyone. 🧪 integration tests 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🧪 tests
Projects
Status: In progress
Status: Todo
Status: In progress
Development

Successfully merging this pull request may close these issues.

Error: environmental_score_details.tt.html: not found
5 participants