Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

juggling of profiles fix numerical order ;) not issue any more #195

Open
MeltTechAu opened this issue Sep 7, 2024 · 2 comments
Open

juggling of profiles fix numerical order ;) not issue any more #195

MeltTechAu opened this issue Sep 7, 2024 · 2 comments

Comments

@MeltTechAu
Copy link

juggling of profiles fix numerical order put in kilncontroller..py :)
label like this 1186 C5 Bisc Std.json

@app.get('/api/profiles')
def get_profiles():
def extract_number(filename):
import re
match = re.search(r'\d+', filename)
return int(match.group()) if match else float('inf')

profile_files = sorted(
    [f for f in os.listdir(profile_path) if os.path.isfile(os.path.join(profile_path, f))],
    key=extract_number
)
profiles = []
for filename in profile_files:
    with open(os.path.join(profile_path, filename), 'r') as f:
        profiles.append(json.load(f))
return json.dumps(profiles)
@jbruce12000
Copy link
Owner

I think you're asking... Hey Jason, I fixed the ordering of profiles and I'd like you to merge this change with main... can you do that for me?

is that what you want?

@MeltTechAu
Copy link
Author

Hi Jason
Yes mate only if you want too! ;)
Have a Great Day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants