mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-10 08:38:34 -05:00
Add ability to set maximum missing ingredient count
This commit is contained in:
@@ -525,7 +525,7 @@ class RecipeSearch():
|
|||||||
steps__ingredients__food__recipe__isnull=True), distinct=True),
|
steps__ingredients__food__recipe__isnull=True), distinct=True),
|
||||||
has_child_sub=Case(When(steps__ingredients__food__in=self.__children_substitute_filter(shopping_users), then=Value(1)), default=Value(0)),
|
has_child_sub=Case(When(steps__ingredients__food__in=self.__children_substitute_filter(shopping_users), then=Value(1)), default=Value(0)),
|
||||||
has_sibling_sub=Case(When(steps__ingredients__food__in=self.__sibling_substitute_filter(shopping_users), then=Value(1)), default=Value(0))
|
has_sibling_sub=Case(When(steps__ingredients__food__in=self.__sibling_substitute_filter(shopping_users), then=Value(1)), default=Value(0))
|
||||||
).annotate(missingfood=F('count_food') - F('count_onhand') - F('count_ignore_shopping')).filter(missingfood=missing)
|
).annotate(missingfood=F('count_food') - F('count_onhand') - F('count_ignore_shopping')).filter(missingfood__lte=missing)
|
||||||
self._queryset = self._queryset.distinct().filter(id__in=makenow_recipes.values('id'))
|
self._queryset = self._queryset.distinct().filter(id__in=makenow_recipes.values('id'))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -665,6 +665,12 @@
|
|||||||
@change="refreshData(false)"
|
@change="refreshData(false)"
|
||||||
class="shadow-none" switch style="width: 4em"/>
|
class="shadow-none" switch style="width: 4em"/>
|
||||||
</b-input-group-text>
|
</b-input-group-text>
|
||||||
|
<b-input-group-text>
|
||||||
|
<span>{{ $t("make_now_count") }}</span>
|
||||||
|
<b-form-input type="number" min="0" max="20" v-model="search.makenow_count"
|
||||||
|
@change="refreshData(false)"
|
||||||
|
size="sm" class="mt-1"></b-form-input>
|
||||||
|
</b-input-group-text>
|
||||||
</b-input-group-append>
|
</b-input-group-append>
|
||||||
</b-input-group>
|
</b-input-group>
|
||||||
</div>
|
</div>
|
||||||
@@ -1041,6 +1047,7 @@ export default {
|
|||||||
timescooked: undefined,
|
timescooked: undefined,
|
||||||
timescooked_gte: true,
|
timescooked_gte: true,
|
||||||
makenow: false,
|
makenow: false,
|
||||||
|
makenow_count: 0,
|
||||||
cookedon: undefined,
|
cookedon: undefined,
|
||||||
cookedon_gte: true,
|
cookedon_gte: true,
|
||||||
createdon: undefined,
|
createdon: undefined,
|
||||||
@@ -1518,6 +1525,10 @@ export default {
|
|||||||
} else if (!this.search.timescooked_gte) {
|
} else if (!this.search.timescooked_gte) {
|
||||||
timescooked = timescooked * -1
|
timescooked = timescooked * -1
|
||||||
}
|
}
|
||||||
|
let makenow = this.search.makenow || undefined
|
||||||
|
if (makenow !== undefined) {
|
||||||
|
makenow = parseInt(this.search.makenow_count)
|
||||||
|
}
|
||||||
// when a filter is selected - added search params will be added to the filter
|
// when a filter is selected - added search params will be added to the filter
|
||||||
params = {
|
params = {
|
||||||
...params,
|
...params,
|
||||||
@@ -1530,7 +1541,7 @@ export default {
|
|||||||
internal: this.search.search_internal,
|
internal: this.search.search_internal,
|
||||||
random: this.random_search,
|
random: this.random_search,
|
||||||
timescooked: timescooked,
|
timescooked: timescooked,
|
||||||
makenow: this.search.makenow || undefined,
|
makenow: makenow,
|
||||||
cookedon: cookedon,
|
cookedon: cookedon,
|
||||||
createdon: createdon,
|
createdon: createdon,
|
||||||
updatedon: updatedon,
|
updatedon: updatedon,
|
||||||
|
|||||||
@@ -362,6 +362,7 @@
|
|||||||
"show_sortby": "Show Sort By",
|
"show_sortby": "Show Sort By",
|
||||||
"search_rank": "Search Rank",
|
"search_rank": "Search Rank",
|
||||||
"make_now": "Make Now",
|
"make_now": "Make Now",
|
||||||
|
"make_now_count": "At most missing ingredients",
|
||||||
"recipe_filter": "Recipe Filter",
|
"recipe_filter": "Recipe Filter",
|
||||||
"book_filter_help": "Include recipes from recipe filter in addition to manually assigned ones.",
|
"book_filter_help": "Include recipes from recipe filter in addition to manually assigned ones.",
|
||||||
"review_shopping": "Review shopping entries before saving",
|
"review_shopping": "Review shopping entries before saving",
|
||||||
|
|||||||
Reference in New Issue
Block a user