mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-04 05:01:37 +02:00
Merge pull request #5 from cadtoolbox/copilot/fix-schedule-dialog-model-bugs
Fix model detection in schedule dialog for library files
This commit is contained in:
@@ -1873,6 +1873,17 @@ async def get_file(
|
||||
)
|
||||
duplicate_count = len(duplicates)
|
||||
|
||||
# Extract key metadata fields
|
||||
print_name = None
|
||||
print_time = None
|
||||
filament_grams = None
|
||||
sliced_for_model = None
|
||||
if file.file_metadata:
|
||||
print_name = file.file_metadata.get("print_name")
|
||||
print_time = file.file_metadata.get("print_time_seconds")
|
||||
filament_grams = file.file_metadata.get("filament_used_grams")
|
||||
sliced_for_model = file.file_metadata.get("sliced_for_model")
|
||||
|
||||
return FileResponseSchema(
|
||||
id=file.id,
|
||||
folder_id=file.folder_id,
|
||||
@@ -1895,6 +1906,10 @@ async def get_file(
|
||||
created_by_username=file.created_by.username if file.created_by else None,
|
||||
created_at=file.created_at,
|
||||
updated_at=file.updated_at,
|
||||
print_name=print_name,
|
||||
print_time_seconds=print_time,
|
||||
filament_used_grams=filament_grams,
|
||||
sliced_for_model=sliced_for_model,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -130,6 +130,12 @@ class FileResponse(BaseModel):
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
# Metadata fields
|
||||
print_name: str | None = None
|
||||
print_time_seconds: int | None = None
|
||||
filament_used_grams: float | None = None
|
||||
sliced_for_model: str | None = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
@@ -3802,6 +3802,11 @@ export interface LibraryFile {
|
||||
created_by_username: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
// Metadata fields
|
||||
print_name: string | null;
|
||||
print_time_seconds: number | null;
|
||||
filament_used_grams: number | null;
|
||||
sliced_for_model: string | null;
|
||||
}
|
||||
|
||||
export interface LibraryFileListItem {
|
||||
|
||||
@@ -180,8 +180,15 @@ export function PrintModal({
|
||||
enabled: !!archiveId && !isLibraryFile,
|
||||
});
|
||||
|
||||
// Fetch library file details to get sliced_for_model
|
||||
const { data: libraryFileDetails } = useQuery({
|
||||
queryKey: ['library-file', libraryFileId],
|
||||
queryFn: () => api.getLibraryFile(libraryFileId!),
|
||||
enabled: isLibraryFile && !!libraryFileId,
|
||||
});
|
||||
|
||||
// Get sliced_for_model from archive or library file
|
||||
const slicedForModel = archiveDetails?.sliced_for_model || null;
|
||||
const slicedForModel = archiveDetails?.sliced_for_model || libraryFileDetails?.sliced_for_model || null;
|
||||
|
||||
// Fetch plates for archives
|
||||
const { data: archivePlatesData, isError: archivePlatesError } = useQuery({
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -23,7 +23,7 @@
|
||||
|
||||
<!-- Splash screens for iOS -->
|
||||
<link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
|
||||
<script type="module" crossorigin src="/assets/index-D3RdYLqK.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-B-cKFWA3.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Mcnrrd7v.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user