Skip to content

Commit 53e51ee

Browse files
committed
Fix minor issues
1 parent 7b6f83e commit 53e51ee

File tree

9 files changed

+46
-44
lines changed

9 files changed

+46
-44
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
asset_content_type: application/vnd.debian.binary-package
8282
- os: ubuntu-latest
8383
container:
84-
image: fedora:latest
84+
image: fedora:41
8585
options: --group-add 135
8686
target: Fedora
8787
build_target: linux

backend/app/controller/item/item_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def searchItemByName(args, household_id):
7575
@authorize_household()
7676
@validate_args(AddItem)
7777
def addItem(args, household_id):
78-
name: str = args["name"].strip()
78+
name: str = args["name"].strip()[:128]
7979
if Item.find_by_name(household_id, name):
8080
raise InvalidUsage()
8181

@@ -113,7 +113,7 @@ def updateItem(args, id):
113113
if "icon" in args:
114114
item.icon = args["icon"]
115115
if "name" in args and args["name"] != item.name:
116-
newName: str = args["name"].strip()
116+
newName: str = args["name"].strip()[:128]
117117
if not Item.find_by_name(item.household_id, newName):
118118
item.name = newName
119119
item.save()

backend/app/jobs/cluster_shoppings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def clusterShoppings(shoppinglist_id: int) -> list | None:
2424
dbs = DBSCAN1D(eps=eps, min_samples=min_samples)
2525
labels = dbs.fit_predict(timestamps)
2626

27-
if not labels:
27+
if labels is None or len(labels) == 0:
2828
app.logger.info("no shopping instances identified")
2929
return None
3030

backend/app/models/item.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def create_by_name(
171171
cls, household_id: int, name: str, default: bool = False
172172
) -> Self:
173173
return cls(
174-
name=name.strip(),
174+
name=name.strip()[:128],
175175
default=default,
176176
household_id=household_id,
177177
).save()
@@ -205,13 +205,15 @@ def search_name(cls, name: str, household_id: int) -> list[Self]:
205205
cls.query.filter(
206206
cls.household_id == household_id,
207207
func.levenshtein(
208-
func.lower(func.substring(cls.name, 1, len(name))), name.lower()
208+
func.lower(func.substring(cls.name, 1, len(name))),
209+
name[:128].lower(),
209210
)
210211
< 4,
211212
)
212213
.order_by(
213214
func.levenshtein(
214-
func.lower(func.substring(cls.name, 1, len(name))), name.lower()
215+
func.lower(func.substring(cls.name, 1, len(name))),
216+
name[:128].lower(),
215217
),
216218
cls.support.desc(),
217219
)

backend/app/service/recipe_scraping.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ def scrapePublic(url: str, html: str, household: Household) -> dict[str, Any] |
1616
except Exception:
1717
return None
1818
recipe = Recipe()
19-
recipe.name = scraper.title()
19+
try:
20+
recipe.name = scraper.title()
21+
except (
22+
NotImplementedError,
23+
ValueError,
24+
TypeError,
25+
AttributeError,
26+
SchemaOrgException,
27+
):
28+
return None # Unsupported if title cannot be scraped
2029
try:
2130
recipe.time = int(scraper.total_time())
2231
except (

backend/uv.lock

Lines changed: 8 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kitchenowl/lib/pages/household_page/recipe_list.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class _RecipeListPageState extends State<RecipeListPage> {
2424
if (!mounted) return 1;
2525
if (BlocProvider.of<RecipeListCubit>(context).state.listView) return 56;
2626
return ((headerKey.currentContext!.size!.width - 16 - 32) / getRowCount()) /
27-
0.8;
27+
0.67;
2828
}
2929

3030
double getHeaderHeight() {
@@ -35,7 +35,7 @@ class _RecipeListPageState extends State<RecipeListPage> {
3535
if (!mounted) return 1;
3636
if (BlocProvider.of<RecipeListCubit>(context).state.listView) return 1;
3737
// header width - list padding
38-
return ((headerKey.currentContext!.size!.width - 16 - 32) / 350).ceil();
38+
return ((headerKey.currentContext!.size!.width - 16 - 32) / 328).ceil();
3939
}
4040

4141
@override
@@ -225,8 +225,8 @@ class _RecipeListPageState extends State<RecipeListPage> {
225225
itemCount: recipes.length,
226226
gridDelegate:
227227
const SliverGridDelegateWithMaxCrossAxisExtent(
228-
maxCrossAxisExtent: 350,
229-
childAspectRatio: 0.8,
228+
maxCrossAxisExtent: 328,
229+
childAspectRatio: 0.67,
230230
),
231231
itemBuilder: (context, i) => RecipeCard(
232232
key: Key(recipes[i].name),

kitchenowl/lib/pages/recipe_cooking_page.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,19 @@ class _RecipeCookingPageState extends State<RecipeCookingPage> {
113113
),
114114
actions: [
115115
IconButton(
116-
onPressed: () => setState(() {
117-
textScaleFactor += 0.1;
118-
}),
116+
onPressed: (textScaleFactor < 4)
117+
? () => setState(() {
118+
textScaleFactor += 0.1;
119+
})
120+
: null,
119121
icon: Icon(Icons.text_increase_rounded),
120122
),
121123
IconButton(
122-
onPressed: () => setState(() {
123-
textScaleFactor -= 0.1;
124-
}),
124+
onPressed: (textScaleFactor > 0.8)
125+
? () => setState(() {
126+
textScaleFactor -= 0.1;
127+
})
128+
: null,
125129
icon: Icon(Icons.text_decrease_rounded),
126130
),
127131
],
@@ -157,6 +161,7 @@ class _RecipeCookingPageState extends State<RecipeCookingPage> {
157161
'recipeItem': RecipeItemMarkdownBuilder(
158162
items: widget.recipe.items)
159163
},
164+
textScaler: TextScaler.linear(textScaleFactor),
160165
extensionSet: extensionSet,
161166
imageBuilder: (uri, title, alt) => Image(
162167
fit: BoxFit.cover,

kitchenowl/lib/widgets/kitchenowl_markdown_builder.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class KitchenOwlMarkdownBuilder extends StatefulWidget {
3232
this.listItemCrossAxisAlignment =
3333
MarkdownListItemCrossAxisAlignment.baseline,
3434
this.softLineBreak = false,
35+
this.textScaler,
3536
});
3637

3738
/// The Markdown to display.
@@ -132,6 +133,8 @@ class KitchenOwlMarkdownBuilder extends StatefulWidget {
132133
/// specification on soft line breaks when lines of text are joined.
133134
final bool softLineBreak;
134135

136+
final TextScaler? textScaler;
137+
135138
@override
136139
State<KitchenOwlMarkdownBuilder> createState() =>
137140
_KitchenOwlMarkdownBuilderState();
@@ -180,6 +183,7 @@ class _KitchenOwlMarkdownBuilderState extends State<KitchenOwlMarkdownBuilder>
180183
Theme.of(context).cardColor,
181184
borderRadius: BorderRadius.circular(2.0),
182185
),
186+
textScaler: widget.textScaler,
183187
),
184188
imageDirectory: widget.imageDirectory,
185189
imageBuilder: widget.imageBuilder ??

0 commit comments

Comments
 (0)