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

make staffing go swoosh #257

Merged
merged 8 commits into from
Nov 7, 2023
Merged

make staffing go swoosh #257

merged 8 commits into from
Nov 7, 2023

Conversation

jonasbjoralt
Copy link
Collaborator

@jonasbjoralt jonasbjoralt commented Nov 6, 2023

Det funker nå, men har riktig nok mye forbedringspotensiale når det kommer til lesbarhet og lett-å-jobbe-med het.

Jeg kommer nok til å jobbe litt videre med dette så vi får kode som er enklere å jobbe med fremover også. Der er noen røde flagg/vonde lukter i koden, blant annet funksjonen "DetailedBooking" som tar inn 7 (!) parametre, og flere av disse er veldig veldig spesialiserte.

Videre kan også Consultants og Projects caches, som reduserer mengen DB-kall ytterligere.

@@ -31,6 +32,8 @@ public ConsultantController(ApplicationContext context, IMemoryCache cache)
[FromQuery(Name = "weeks")] int numberOfWeeks = 8,
[FromQuery(Name = "includeOccupied")] bool includeOccupied = true)
{
var watch = Stopwatch.StartNew();
Copy link
Contributor

Choose a reason for hiding this comment

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

Husk å fjern denne før vi merger

}


private List<ConsultantReadModel> GetConsultantsWithAvailability(string orgUrlKey, Week initialWeekNumber,
int numberOfWeeks)
{
if (numberOfWeeks == 8)
if (numberOfWeeks == 8 && false)
Copy link
Contributor

@trulshj trulshj Nov 6, 2023

Choose a reason for hiding this comment

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

Suggested change
if (numberOfWeeks == 8 && false)
if (CacheEnabled && numberOfWeeks == 8)

boom-mic-drop-gif

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ups, denne skal helt vekk. Dette var bare for å tvinge vekk bruken av cache for å sammenligne kjøretiden mellom gammel og ny måte

@jonasbjoralt jonasbjoralt marked this pull request as ready for review November 6, 2023 19:27
@jonasbjoralt
Copy link
Collaborator Author

Har oppdatert litt lesbarhet nå. Det blir være helt likt logisk sett, men den bør testes før merge

var consultants = GetConsultantsWithAvailability(orgUrlKey, selectedWeek, numberOfWeeks)
var weekSet = DateService.GetNextWeeks(selectedWeek, numberOfWeeks);

var consultants = GetConsultantReadModels(orgUrlKey, weekSet)
.Where(c =>
includeOccupied
|| c.IsOccupied
Copy link
Contributor

Choose a reason for hiding this comment

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

Dette har ingen ting med denne PR-en å gjøre egentlig, men skal det ikke være includeOccupied || !c.IsOccupied? For nå får man enten alle, eller kun de som er opptatt 🤔

Copy link
Contributor

@sigridge sigridge left a comment

Choose a reason for hiding this comment

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

Synes dette ser veldig bra ut! Og den går helt klart mye raskere! Sykt bra jobba!

@sigridge sigridge mentioned this pull request Nov 7, 2023
@jonasbjoralt jonasbjoralt merged commit e52b210 into main Nov 7, 2023
3 checks passed
@jonasbjoralt jonasbjoralt deleted the 253-make-fast branch November 7, 2023 08:16
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

Successfully merging this pull request may close these issues.

3 participants