Skip to content

Commit cdd700d

Browse files
committed
Merge branch 'develop' into beta
2 parents ad6fe5f + 7ccdb90 commit cdd700d

File tree

112 files changed

+5558
-4695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+5558
-4695
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
./cookbook/static
3939
./staticfiles
4040
key: |
41-
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue/src/*') }}
41+
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue3/src/*') }}
4242
4343
# Build Vue frontend & Dependencies
4444
- name: Set up Node ${{ matrix.node-version }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,5 @@ venv/
8989
.idea/easy-i18n.xml
9090
cookbook/static/vue3
9191
vue3/node_modules
92+
cookbook/tests/other/docs/reports/tests/tests.html
93+
cookbook/tests/other/docs/reports/tests/pytest.xml

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
FROM python:3.13-alpine3.21
22

33
#Install all dependencies.
4-
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev openldap git libgcc libstdc++
4+
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev openldap git libgcc libstdc++ nginx
55

66
#Print all logs without buffering it.
77
ENV PYTHONUNBUFFERED 1
88

99
ENV DOCKER true
1010

1111
#This port will be used by gunicorn.
12-
EXPOSE 8080
12+
EXPOSE 80 8080
1313

1414
#Create app dir and install requirements.
1515
RUN mkdir /opt/recipes
@@ -40,6 +40,10 @@ RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-de
4040
#Copy project and execute it.
4141
COPY . ./
4242

43+
# delete default nginx config and link it to tandoors config
44+
RUN rm -rf /etc/nginx/http.d
45+
RUN ln -s /opt/recipes/http.d /etc/nginx/http.d
46+
4347
# commented for now https://github.com/TandoorRecipes/recipes/issues/3478
4448
#HEALTHCHECK --interval=30s \
4549
# --timeout=5s \

boot.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ TANDOOR_PORT="${TANDOOR_PORT:-8080}"
55
GUNICORN_WORKERS="${GUNICORN_WORKERS:-3}"
66
GUNICORN_THREADS="${GUNICORN_THREADS:-2}"
77
GUNICORN_LOG_LEVEL="${GUNICORN_LOG_LEVEL:-'info'}"
8-
NGINX_CONF_FILE=/opt/recipes/nginx/conf.d/Recipes.conf
98

109
display_warning() {
1110
echo "[WARNING]"
@@ -14,11 +13,6 @@ display_warning() {
1413

1514
echo "Checking configuration..."
1615

17-
# Nginx config file must exist if gunicorn is not active
18-
if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -eq 0 ]; then
19-
display_warning "Nginx configuration file could not be found at the default location!\nPath: ${NGINX_CONF_FILE}"
20-
fi
21-
2216
# SECRET_KEY (or a valid file at SECRET_KEY_FILE) must be set in .env file
2317

2418
if [ -f "${SECRET_KEY_FILE}" ]; then
@@ -92,6 +86,11 @@ chmod -R 755 /opt/recipes/mediafiles
9286

9387
ipv6_disable=$(cat /sys/module/ipv6/parameters/disable)
9488

89+
# start nginx
90+
echo "Starting nginx"
91+
nginx
92+
93+
echo "Starting gunicorn"
9594
# Check if IPv6 is enabled, only then run gunicorn with ipv6 support
9695
if [ "$ipv6_disable" -eq 0 ]; then
9796
exec gunicorn -b "[::]:$TANDOOR_PORT" --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi

cookbook/helper/ingredient_parser.py

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -211,44 +211,46 @@ def parse(self, ingredient):
211211
# three arguments if it already has a unit there can't be
212212
# a fraction for the amount
213213
if len(tokens) > 2:
214+
never_unit_applied = False
214215
if not self.ignore_rules:
215216
tokens, never_unit_applied = self.automation.apply_never_unit_automation(tokens)
216-
if never_unit_applied:
217-
unit = tokens[1]
218-
food, note = self.parse_food(tokens[2:])
219-
else:
220-
try:
221-
if unit is not None:
222-
# a unit is already found, no need to try the second argument for a fraction
223-
# probably not the best method to do it, but I didn't want to make an if check and paste the exact same thing in the else as already is in the except
224-
raise ValueError
225-
# try to parse second argument as amount and add that, in case of '2 1/2' or '2 ½'
226-
if tokens[1]:
227-
amount += self.parse_fraction(tokens[1])
228-
# assume that units can't end with a comma
229-
if len(tokens) > 3 and not tokens[2].endswith(','):
230-
# try to use third argument as unit and everything else as food, use everything as food if it fails
231-
try:
232-
food, note = self.parse_food(tokens[3:])
233-
unit = tokens[2]
234-
except ValueError:
235-
food, note = self.parse_food(tokens[2:])
236-
else:
217+
218+
if never_unit_applied:
219+
unit = tokens[1]
220+
food, note = self.parse_food(tokens[2:])
221+
else:
222+
try:
223+
if unit is not None:
224+
# a unit is already found, no need to try the second argument for a fraction
225+
# probably not the best method to do it, but I didn't want to make an if check and paste the exact same thing in the else as already is in the except
226+
raise ValueError
227+
# try to parse second argument as amount and add that, in case of '2 1/2' or '2 ½'
228+
if tokens[1]:
229+
amount += self.parse_fraction(tokens[1])
230+
# assume that units can't end with a comma
231+
if len(tokens) > 3 and not tokens[2].endswith(','):
232+
# try to use third argument as unit and everything else as food, use everything as food if it fails
233+
try:
234+
food, note = self.parse_food(tokens[3:])
235+
unit = tokens[2]
236+
except ValueError:
237+
food, note = self.parse_food(tokens[2:])
238+
else:
239+
food, note = self.parse_food(tokens[2:])
240+
except ValueError:
241+
# assume that units can't end with a comma
242+
if not tokens[1].endswith(','):
243+
# try to use second argument as unit and everything else as food, use everything as food if it fails
244+
try:
237245
food, note = self.parse_food(tokens[2:])
238-
except ValueError:
239-
# assume that units can't end with a comma
240-
if not tokens[1].endswith(','):
241-
# try to use second argument as unit and everything else as food, use everything as food if it fails
242-
try:
243-
food, note = self.parse_food(tokens[2:])
244-
if unit is None:
245-
unit = tokens[1]
246-
else:
247-
note = tokens[1]
248-
except ValueError:
249-
food, note = self.parse_food(tokens[1:])
250-
else:
246+
if unit is None:
247+
unit = tokens[1]
248+
else:
249+
note = tokens[1]
250+
except ValueError:
251251
food, note = self.parse_food(tokens[1:])
252+
else:
253+
food, note = self.parse_food(tokens[1:])
252254
else:
253255
# only two arguments, first one is the amount
254256
# which means this is the food
@@ -269,6 +271,7 @@ def parse(self, ingredient):
269271

270272
if food and not self.ignore_rules:
271273
food = self.automation.apply_food_automation(food)
274+
272275
if len(food) > Food._meta.get_field('name').max_length: # test if food name is to long
273276
# try splitting it at a space and taking only the first arg
274277
if len(food.split()) > 1 and len(food.split()[0]) < Food._meta.get_field('name').max_length:

cookbook/helper/property_helper.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@ def calculate_recipe_properties(self, recipe):
6262
computed_properties[pt.id]['food_values'] = self.add_or_create(
6363
computed_properties[p.property_type.id]['food_values'], c.food.id, (c.amount / i.food.properties_food_amount) * p.property_amount, c.food)
6464
if not found_property:
65-
if i.amount == 0 or i.no_amount: # don't count ingredients without an amount as missing
66-
computed_properties[pt.id]['missing_value'] = computed_properties[pt.id]['missing_value'] or False # don't override if another food was already missing
65+
# if no amount and food does not exist yet add it but don't count as missing
66+
if i.amount == 0 or i.no_amount and i.food.id not in computed_properties[pt.id]['food_values']:
6767
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': {'id': i.food.id, 'name': i.food.name}, 'value': 0}
68+
# if amount is present but unit is missing indicate it in the result
69+
elif i.unit is None:
70+
if i.food.id not in computed_properties[pt.id]['food_values']:
71+
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': {'id': i.food.id, 'name': i.food.name}, 'value': 0}
72+
computed_properties[pt.id]['food_values'][i.food.id]['missing_unit'] = True
6873
else:
6974
computed_properties[pt.id]['missing_value'] = True
7075
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': {'id': i.food.id, 'name': i.food.name}, 'value': None}

cookbook/locale/lv/LC_MESSAGES/django.po

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgstr ""
1111
"Project-Id-Version: PACKAGE VERSION\n"
1212
"Report-Msgid-Bugs-To: \n"
1313
"POT-Creation-Date: 2024-08-01 15:04+0200\n"
14-
"PO-Revision-Date: 2024-11-05 10:58+0000\n"
14+
"PO-Revision-Date: 2025-07-21 09:43+0000\n"
1515
"Last-Translator: Aija Kozlovska <[email protected]>\n"
1616
"Language-Team: Latvian <http://translate.tandoor.dev/projects/tandoor/"
1717
"recipes-backend/lv/>\n"
@@ -20,7 +20,7 @@ msgstr ""
2020
"Content-Type: text/plain; charset=UTF-8\n"
2121
"Content-Transfer-Encoding: 8bit\n"
2222
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;\n"
23-
"X-Generator: Weblate 5.6.2\n"
23+
"X-Generator: Weblate 5.8.4\n"
2424

2525
#: .\cookbook\forms.py:45
2626
msgid ""
@@ -83,8 +83,8 @@ msgid ""
8383
"Leave empty for dropbox and enter only base url for nextcloud (<code>/remote."
8484
"php/webdav/</code> is added automatically)"
8585
msgstr ""
86-
"Atstājiet tukšu Dropbox un ievadiet tikai Nextcloud bāzes URL (<kods> /"
87-
"remote.php/webdav/ </code> tiek pievienots automātiski)"
86+
"Atstājiet tukšu Dropbox un ievadiet tikai Nextcloud bāzes URL (<code> /remote"
87+
".php/webdav/ </code> tiek pievienots automātiski)"
8888

8989
#: .\cookbook\forms.py:188
9090
msgid ""
@@ -147,48 +147,65 @@ msgid ""
147147
"Determines how fuzzy a search is if it uses trigram similarity matching (e."
148148
"g. low values mean more typos are ignored)."
149149
msgstr ""
150+
"Nosaka cik precīza ir meklēšana gadījumā, ja tiek izmantota trigram līdzība ("
151+
"jo zemāka vērtība, jo vairāk rakstīšanas kļūdas tiek ignorētas)."
150152

151153
#: .\cookbook\forms.py:340
152154
msgid ""
153155
"Select type method of search. Click <a href=\"/docs/search/\">here</a> for "
154156
"full description of choices."
155157
msgstr ""
158+
"Izvēlies meklēšanas veidu. Spied <a href=\"/docs/search/\">šeit</a>, lai "
159+
"apskatītu visas iespējas."
156160

157161
#: .\cookbook\forms.py:341
158162
msgid ""
159163
"Use fuzzy matching on units, keywords and ingredients when editing and "
160164
"importing recipes."
161165
msgstr ""
166+
"Izmanto aptuveno meklēšanu vienībām, atslēgas vārdiem un sastāvdaļām "
167+
"importējot un labojot receptes."
162168

163169
#: .\cookbook\forms.py:342
164170
msgid ""
165171
"Fields to search ignoring accents. Selecting this option can improve or "
166172
"degrade search quality depending on language"
167173
msgstr ""
174+
"Lauki, kurus meklējot ignorēt akcentus. Šī varianta izvēlēšanās var uzlabot "
175+
"vai pasliktināt meklēšanas kvalitāti atkarībā no valodas"
168176

169177
#: .\cookbook\forms.py:343
170178
msgid ""
171179
"Fields to search for partial matches. (e.g. searching for 'Pie' will return "
172180
"'pie' and 'piece' and 'soapie')"
173181
msgstr ""
182+
"Lauki, kuros meklēt aptuveno līdzību. (piem. meklējot vārdu 'Kūka' tiks "
183+
"atrasts arī 'kūka' un 'ābolkūka')"
174184

175185
#: .\cookbook\forms.py:344
176186
msgid ""
177187
"Fields to search for beginning of word matches. (e.g. searching for 'sa' "
178188
"will return 'salad' and 'sandwich')"
179189
msgstr ""
190+
"Lauki, kuros meklēt vārdu līdzības sākumu. (piem meklējot 'la' atradīt "
191+
"'lapas' un 'laims')"
180192

181193
#: .\cookbook\forms.py:345
182194
msgid ""
183195
"Fields to 'fuzzy' search. (e.g. searching for 'recpie' will find 'recipe'.) "
184196
"Note: this option will conflict with 'web' and 'raw' methods of search."
185197
msgstr ""
198+
"Lauki, kuriem izmantot aptuveno meklēšanu. (piem. meklējot 'recpte' tiks "
199+
"atrasts 'recepte'.) Piezīme: šis variants konfliktēs ar 'web' un 'raw' "
200+
"meklēšanas metodēm."
186201

187202
#: .\cookbook\forms.py:346
188203
msgid ""
189204
"Fields to full text search. Note: 'web', 'phrase', and 'raw' search methods "
190205
"only function with fulltext fields."
191206
msgstr ""
207+
"Lauki priekš pilnās teksta meklēšanas. Piezīme: 'web', 'phrase' un 'raw' "
208+
"meklēšanas metodes darbojās tikai ar pilno teksta meklēšanu."
192209

193210
#: .\cookbook\forms.py:350
194211
#, fuzzy
@@ -198,11 +215,11 @@ msgstr "Meklēt"
198215

199216
#: .\cookbook\forms.py:350
200217
msgid "Fuzzy Lookups"
201-
msgstr ""
218+
msgstr "Aptuvenā meklēšana"
202219

203220
#: .\cookbook\forms.py:350
204221
msgid "Ignore Accent"
205-
msgstr ""
222+
msgstr "Ignorēt akcentus"
206223

207224
#: .\cookbook\forms.py:350
208225
msgid "Partial Match"
@@ -745,8 +762,8 @@ msgid ""
745762
" ."
746763
msgstr ""
747764
"Lūdzu apstipriniet, ka\n"
748-
" <a href=\"mailto:%(email)s\">%(email)s</a> ir lietotāja "
749-
"%(user_display) e-pasta adrese\n"
765+
" <a href=\"mailto:%(email)s\">%(email)s</a> ir e-pasta adrese "
766+
"lietotājam %(user_display)\n"
750767
" ."
751768

752769
#: .\cookbook\templates\account\email_confirm.html:22
@@ -1331,7 +1348,7 @@ msgstr ""
13311348
#: .\cookbook\templates\markdown_info.html:57
13321349
#: .\cookbook\templates\markdown_info.html:73
13331350
msgid "or by leaving a blank line in between."
1334-
msgstr "vai atstājot tukšu rindu starp ."
1351+
msgstr "vai atstājot tukšu rindu starp."
13351352

13361353
#: .\cookbook\templates\markdown_info.html:59
13371354
#: .\cookbook\templates\markdown_info.html:74
@@ -1443,7 +1460,7 @@ msgstr "Nav Tiesību"
14431460

14441461
#: .\cookbook\templates\no_groups_info.html:17
14451462
msgid "You do not have any groups and therefor cannot use this application."
1446-
msgstr "Jūs neesat nevienā grupā un tādēļ nevarat izmantot šo lietotni!"
1463+
msgstr "Jūs neesat nevienā grupā un tādēļ nevarat izmantot šo lietotni."
14471464

14481465
#: .\cookbook\templates\no_groups_info.html:18
14491466
#: .\cookbook\templates\no_perm_info.html:15
@@ -1460,7 +1477,7 @@ msgid ""
14601477
"You do not have the required permissions to view this page or perform this "
14611478
"action."
14621479
msgstr ""
1463-
"Jums nav nepieciešamo atļauju, lai skatītu šo vietni vai veiktu šo darbību!"
1480+
"Jums nav nepieciešamo atļauju, lai skatītu šo vietni vai veiktu šo darbību."
14641481

14651482
#: .\cookbook\templates\offline.html:6
14661483
msgid "Offline"
@@ -1548,6 +1565,16 @@ msgid ""
15481565
"html#TEXTSEARCH-PARSING-QUERIES>Postgresql's website.</a>\n"
15491566
" "
15501567
msgstr ""
1568+
" \n"
1569+
" Pilnā teksta meklēšanas mēģinājums vienkāršot dotos vārdus, lai "
1570+
"tie sakristu ar tipiskajiem variantiem. Piemēram: 'griezt', 'griezšana', "
1571+
"'griezums' tiks vienkāršots uz 'griez'.\n"
1572+
" Lai kontrolētu meklētāja darbību ievadot vairākus meklējamos "
1573+
"vārdus, ir pieejamas vairākas zemāk aprakstītās metodes.\n"
1574+
" Pilno tehnisko informāciju par tām var apskatīt <a "
1575+
"href=https://www.postgresql.org/docs/current/textsearch-controls.html"
1576+
"#TEXTSEARCH-PARSING-QUERIES>Postgresql mājas lapā.</a>\n"
1577+
" "
15511578

15521579
#: .\cookbook\templates\search_info.html:29
15531580
msgid ""
@@ -2547,22 +2574,12 @@ msgid "Unable to determine PostgreSQL version."
25472574
msgstr ""
25482575

25492576
#: .\cookbook\views\views.py:317
2550-
#, fuzzy
2551-
#| msgid ""
2552-
#| "\n"
2553-
#| " This application is not running with a Postgres database "
2554-
#| "backend. This is ok but not recommended as some\n"
2555-
#| " features only work with postgres databases.\n"
2556-
#| " "
25572577
msgid ""
25582578
"This application is not running with a Postgres database backend. This is ok "
25592579
"but not recommended as some features only work with postgres databases."
25602580
msgstr ""
2561-
"\n"
2562-
" Šī lietojumprogramma nedarbojas, izmantojot Postgres datubāzi. "
2563-
"Tas ir labi, bet nav ieteicams, jo dažas\n"
2564-
" funkcijas darbojas tikai ar Postgres datu bāzēm.\n"
2565-
" "
2581+
"Šī lietojumprogramma nedarbojas, izmantojot Postgres datubāzi. Tas ir labi, "
2582+
"bet nav ieteicams, jo dažas funkcijas darbojas tikai ar Postgres datu bāzēm."
25662583

25672584
#: .\cookbook\views\views.py:360
25682585
#, fuzzy

0 commit comments

Comments
 (0)