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

Feat/backend/deep user based analytics #355

Merged
merged 30 commits into from
Sep 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
24d208e
Refactor Attendance struct field names for consistency
waveyboym Sep 7, 2024
f16ea22
Refactor GetAnalyticsOnHours function to use aggregation pipeline for…
waveyboym Sep 7, 2024
3e404e2
Refactor GetAnalyticsOnHours function to use aggregation pipeline for…
waveyboym Sep 7, 2024
0294662
Refactor GetAnalyticsOnHours function to improve performance using ag…
waveyboym Sep 8, 2024
d9b51dc
Refactor GetAnalyticsOnHours function to add new pipeline stages
waveyboym Sep 8, 2024
d4793bc
Refactor GetAnalyticsOnHours function to add new pipeline stage for c…
waveyboym Sep 8, 2024
9901b7a
Refactor GetAnalyticsOnHours function to use CalculateInOfficeRate in…
waveyboym Sep 8, 2024
8377f42
Refactor GetAnalyticsOnHours function to add pagination and improve p…
waveyboym Sep 8, 2024
e620341
Refactor createMatchFilter function to use PascalCase for consistency
waveyboym Sep 8, 2024
b1f140e
Refactor CreateMatchFilter function to append time range filters only…
waveyboym Sep 8, 2024
695cca7
Refactor CreateMatchFilter function to use a variable for the match f…
waveyboym Sep 8, 2024
c3fad5f
Refactor analytics_test.go to add test for AverageOfficeHoursByWeekda…
waveyboym Sep 8, 2024
2a2e1f8
Refactor analytics_test.go to add tests for RatioInOutOfficeByWeekday…
waveyboym Sep 8, 2024
d8659ca
Refactor analytics_test.go to rename TestRatioInOutOfficeByWeekday to…
waveyboym Sep 8, 2024
9a7a668
Refactor analytics_test.go to add test for LeastInOfficeWorker function
waveyboym Sep 8, 2024
31aaee7
Refactor analytics_test.go to add test for MostInOfficeWorker function
waveyboym Sep 8, 2024
bb88126
Refactor analytics_test.go to add test for AverageArrivalAndDeparture…
waveyboym Sep 8, 2024
942994b
Add test for CalculateInOfficeRate function in analytics_test.go
waveyboym Sep 8, 2024
38f7246
Refactor test commands in GitHub workflows to include analytics packa…
waveyboym Sep 8, 2024
552aeea
Refactor test commands in sh files for coverage report
waveyboym Sep 8, 2024
6bb79ef
Refactor database_helpers.go and tests/database_test.go
waveyboym Sep 8, 2024
b6ef9b5
Refactor GetAnalyticsOnHours function to use MakeEmailAndTimeFilter h…
waveyboym Sep 8, 2024
1a22740
Refactor GetAnalyticsOnHours test to use specific time range for accu…
waveyboym Sep 8, 2024
01c3c31
Refactor GetAnalyticsOnHours test to use specific time range for accu…
waveyboym Sep 9, 2024
bbff688
Refactor GetAnalyticsOnHours and FilterCollectionWithProjection funct…
waveyboym Sep 9, 2024
557f720
Refactor API documentation to remove unnecessary email field in JSON …
waveyboym Sep 9, 2024
9f2f782
Refactor MakeEmailAndTimeFilter function to handle time range filters
waveyboym Sep 9, 2024
e8fbd96
Merge branch 'develop' of https://github.com/COS301-SE-2024/occupi in…
waveyboym Sep 9, 2024
d739dc1
Refactor GetCentrifugoSecret function to use a more descriptive varia…
waveyboym Sep 9, 2024
a9f051b
Refactor GetAnalyticsOnHours test to include proper assertions
waveyboym Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor analytics_test.go to add test for LeastInOfficeWorker function
  • Loading branch information
waveyboym committed Sep 8, 2024
commit 9a7a668029324b730ff204276402e4054395adb1
12 changes: 12 additions & 0 deletions occupi-backend/tests/analytics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,15 @@ func TestBusiestHoursByWeekday(t *testing.T) {
t.Errorf("BusiestHoursByWeekday() = %v, want greater than 0", res)
}
}

func TestLeastInOfficeWorker(t *testing.T) {
email := "test@example.com"
filter := models.OfficeHoursFilterStruct{Filter: bson.M{}}

res := analytics.LeastMostInOfficeWorker(email, filter, true)

// check len is greater than 0
if len(res) == 0 {
t.Errorf("LeastMostInOfficeWorker() = %v, want greater than 0", res)
}
}