Skip to content

Glasgow | Sheetal Kharab | Module-Decomposition | Sprint 4 | Implement laptop allocation#29

Open
sheetalkharab wants to merge 3 commits intoCodeYourFuture:mainfrom
sheetalkharab:feature/allocate-laptops
Open

Glasgow | Sheetal Kharab | Module-Decomposition | Sprint 4 | Implement laptop allocation#29
sheetalkharab wants to merge 3 commits intoCodeYourFuture:mainfrom
sheetalkharab:feature/allocate-laptops

Conversation

@sheetalkharab
Copy link

@sheetalkharab sheetalkharab commented Oct 13, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

laptop allocation function

Questions

No

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@sheetalkharab sheetalkharab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 2025
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the lateness in the review, this is a good implementation, but you might want to consider the efficiency. I've left a comment about that in the code. Can you think of any changes that could improve that?

for person in people:
# Find laptop that gives this person minimum sadness
if available_laptops:
best_laptop = min(available_laptops, key=lambda l: calculate_sadness(person, l))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method works, one thing to be careful of is this think how often this function will run.

It will always run, for every laptop, even if the very first one were a perfect match.

It's not an issue in your example here, but imagine if we were running this with thousands of laptop and people entries

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 28, 2025
@sheetalkharab
Copy link
Author

@LonMcGregor sorry for late resonse and thanks for the feedback. I’ve updated the allocation logic to avoid calling calculate_sadness on every available laptop as you suggested.

@sheetalkharab sheetalkharab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 26, 2026
@github-actions
Copy link

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 26, 2026
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good change

@LonMcGregor LonMcGregor added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 2, 2026
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

1 similar comment
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants