Skip to content

Commit

Permalink
Merge branch 'main' into pr-10970-unblock/upgrade-jquery-v2.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaddison committed Dec 10, 2024
2 parents 10e12e9 + 59bb204 commit 935e7e0
Show file tree
Hide file tree
Showing 139 changed files with 1,199 additions and 877 deletions.
33 changes: 17 additions & 16 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -505,21 +505,6 @@ Data import:
- any-glob-to-any-file: 'cgi/generate_sample_import_file.pl'

# https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Ingredients.html
🥗 Ingredients:
- changed-files:
- any-glob-to-any-file: 'lib/ProductOpener/Ingredients.pm'
- any-glob-to-any-file: 'taxonomies/food/ingredients.txt'
- any-glob-to-any-file: 'tests/unit/ingredients.t'
- any-glob-to-any-file: 'tests/unit/ingredients_analysis.t'
- any-glob-to-any-file: 'tests/unit/ingredients_clean.t'
- any-glob-to-any-file: 'tests/unit/ingredients_nesting.t'
- any-glob-to-any-file: 'tests/unit/ingredients_parsing.t'
- any-glob-to-any-file: 'tests/unit/ingredients_parsing_todo.t'
- any-glob-to-any-file: 'tests/unit/ingredients_percent.t'
- any-glob-to-any-file: 'tests/unit/ingredients_processing.t'
- any-glob-to-any-file: 'tests/unit/ingredients_tags.t'
- any-glob-to-any-file: 'scripts/test_ingredient_parser.pl'

# We want to improve the analysis of ingredient list to extract ingredients and their properties, across languages.
# This is helpful to determine if a product is vegan, vegetarian, contains palm oil, is kosher/halal, the exact Nutri-Score, how much environmental impact it has…
# https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis
Expand All @@ -538,7 +523,23 @@ Data import:
- any-glob-to-any-file: 'scripts/extract_individual_ingredients.pl'
- any-glob-to-any-file: 'scripts/aggregate_ingredients.pl'
- any-glob-to-any-file: 'lib/ProductOpener/Ingredients.pm'

- any-glob-to-any-file: 'tests/unit/ingredients_parsing.t'
- any-glob-to-any-file: 'lib/ProductOpener/Ingredients.pm'
- any-glob-to-any-file: 'taxonomies/food/ingredients.txt'
- any-glob-to-any-file: 'tests/unit/ingredients.t'
- any-glob-to-any-file: 'tests/unit/ingredients_analysis.t'
- any-glob-to-any-file: 'tests/unit/ingredients_clean.t'
- any-glob-to-any-file: 'tests/unit/ingredients_nesting.t'
- any-glob-to-any-file: 'tests/unit/ingredients_parsing_todo.t'
- any-glob-to-any-file: 'tests/unit/ingredients_percent.t'
- any-glob-to-any-file: 'tests/unit/ingredients_processing.t'
- any-glob-to-any-file: 'tests/unit/ingredients_tags.t'
- any-glob-to-any-file: 'scripts/test_ingredient_parser.pl'
- any-glob-to-any-file: 'tests/unit/expected_test_results/ingredients/en-category-types.json'
- any-glob-to-any-file: 'tests/unit/expected_test_results/ingredients/fr-infinite-loop-allergens.json'
- any-glob-to-any-file: 'tests/unit/expected_test_results/ingredients/fr-marmelade.json'
- any-glob-to-any-file: 'tests/unit/expected_test_results/ingredients/fr-percents-origins-2.json'
- any-glob-to-any-file: 'tests/unit/expected_test_results/ingredients/ru-russian-oil.json'
# Labels are all claims present on product packages.
# https://wiki.openfoodfacts.org/Labels
# Tracking issue:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Deploy API documentation to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.6.9
uses: JamesIves/github-pages-deploy-action@v4.7.2
# we only deploy on push to main
if: |
github.event_name == 'push' && github.event.ref == 'refs/heads/main'
Expand Down
13 changes: 1 addition & 12 deletions cgi/product_image_move.pl
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
my $code = normalize_code(single_param('code'));
my $imgids = single_param('imgids');
my $move_to = single_param('move_to_override');
if ($move_to =~ /^(off|obf|opf|opff)$/) {
$move_to .= ':' . $code;
}
elsif ($move_to ne 'trash') {
if ($move_to ne 'trash') {
$move_to = normalize_code($move_to);
}
my $copy_data = single_param('copy_data_override');
Expand Down Expand Up @@ -223,14 +220,6 @@

$response{url} = product_url($move_to);

# URL on another server?
my $server = server_for_product_id($move_to);
if (defined $server) {
my $url = "https://" . $subdomain . "." . $options{other_servers}{$server}{domain} . $response{url};
$url =~ s/\/([a-z]+):([0-9])/\/$2/;
$response{url} = $url;
}

$response{link} = '<a href="' . $response{url} . '">' . $move_to . '</a>';
}

Expand Down
11 changes: 9 additions & 2 deletions docs/dev/how-to-quick-start-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,21 @@ The process of cloning the repository will create a number of symbolic links whi
Make sure you also activated the [Developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) on your device.


### Windows Subsystem for Linux (WSL) Prequisites
### Windows Subsystem for Linux (WSL) Prerequisites

Ensure that you have WSL installed on your Windows machine. For instructions on how to do so, you can follow [Microsoft's guide to install WSL](https://learn.microsoft.com/en-us/windows/wsl/install).

After succcessfully installing WSL, you need to set up your Linux distribution and install Docker on it:
- Go to the Microsoft Store and install [Ubuntu](https://www.microsoft.com/store/productId/9PDXGNCFSCZV?ocid=pdpshare) as your Linux distribution
- Open Ubuntu and execute the commands/instructions specified in [Installing Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/) (**NOTE: this is NOT the same thing as Docker for Desktop)
- Restart your computer to ensure all changes take effect and WSL can properly integrate with Docker
- Restart your computer to ensure all changes take effect and WSL can properly integrate with Docker

### Docker Desktop Prerequisite

If you use Docker Desktop:

- ensure you allow enough memory for your VMs (at least 4G)
- ensure you Enabled host networking (in Resources / Network)


## 2. Fork and clone the repository from GitHub
Expand Down
30 changes: 6 additions & 24 deletions lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2596,6 +2596,11 @@ HTML
$extra_column_searchable .= ', {"searchable": false}';
}

# additive table has an extra column for risks
if ($tagtype eq 'additives') {
$extra_column_searchable .= ', {"searchable": false}';
}

$request_ref->{initjs} .= <<JS
let oTable = \$('#tagstable').DataTable({
language: {
Expand Down Expand Up @@ -5875,7 +5880,6 @@ facets.

sub display_pagination ($request_ref, $count, $limit, $page) {

my $html = '';
my $html_pages = '';

$log->debug("PAGINATION: START\n", {count => $count, limit => $limit, page => $page}) if $log->is_debug();
Expand Down Expand Up @@ -5982,29 +5986,7 @@ sub display_pagination ($request_ref, $count, $limit, $page) {
. "</ul>\n";
}

# Close the list

if (defined single_param("jqm")) {
if (defined $next_page_url) {
my $loadmore = lang("loadmore");
$html .= <<HTML
<li id="loadmore" style="text-align:center"><a href="${formatted_subdomain}/${next_page_url}&jqm_loadmore=1" id="loadmorelink">$loadmore</a></li>
HTML
;
}
else {
$html .= '<br><br>';
}
}

if (not defined $request_ref->{jqm_loadmore}) {
$html .= "</ul>\n";
}

if (not defined single_param("jqm")) {
$html .= $html_pages;
}
return $html;
return $html_pages;
}

sub search_and_export_products ($request_ref, $query_ref, $sort_by) {
Expand Down
4 changes: 2 additions & 2 deletions lib/ProductOpener/Images.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1050,11 +1050,11 @@ sub process_image_upload ($product_id, $imagefield, $user_id, $time, $comment, $
# Create a link to the image in /new_images so that it can be batch processed by OCR
# and computer vision algorithms

(-e "$BASE_DIRS{PRODUCTS}/new_images") or mkdir("$BASE_DIRS{PRODUCTS}/new_images", 0755);
(-e "$BASE_DIRS{CACHE_NEW_IMAGES}") or mkdir("$BASE_DIRS{CACHE_NEW_IMAGES}", 0755);
my $code = $product_id;
$code =~ s/.*\///;
symlink("$target_image_dir/$imgid.jpg",
"$BASE_DIRS{PRODUCTS}/new_images/" . time() . "." . $code . "." . $imagefield . "." . $imgid . ".jpg");
"$BASE_DIRS{CACHE_NEW_IMAGES}/" . time() . "." . $code . "." . $imagefield . "." . $imgid . ".jpg");

# Save the image file size so that we can skip the image before processing it if it is uploaded again
$images_ref->{$size_orig} = $imgid;
Expand Down
Loading

0 comments on commit 935e7e0

Please sign in to comment.