[All] Add missing pandata events#3629
Conversation
🧪 Unit Test Results📊 Summary
Last updated: Tue, 07 Apr 2026 12:48:06 GMT |
There was a problem hiding this comment.
PageView Annotation Additions — Review
This PR adds @PageView tracking to a number of fragments across the student and teacher apps. The overall approach is consistent with how page view tracking works elsewhere in the codebase. A few issues need attention before this is correct at runtime.
Issues
-
StudentContextFragment— private getters won't be found by reflection
apps/teacher/src/main/java/com/instructure/teacher/adapters/StudentContextFragment.ktlines 94–97@get:PageViewUrlParamonprivate var mStudentIdandprivate var mCourseIdwon't work.PageViewAnnotationProcessorusesenclosingClass.methodsto find annotated params, which only returns public methods. Aprivate vargenerates a private getter that is invisible to this reflection call, so{userId}and{courseId}in the URL template will never be substituted — the tracked URL will contain literal{userId}/{courseId}placeholders.All existing usages in the codebase (
AssignmentDetailsFragment,SubmissionDetailsFragment,SpeedGraderFragment, etc.) use default (public) visibility. Change to:@get:PageViewUrlParam("userId") var mStudentId by LongArg() @get:PageViewUrlParam("courseId") var mCourseId by LongArg()
-
ModuleProgressionFragment— same private getter reflection issue
apps/teacher/src/main/java/com/instructure/teacher/features/modules/progression/ModuleProgressionFragment.ktline 60–61private val moduleItemIdwith@get:PageViewUrlParam("moduleItemId")has the same problem — the private getter won't be discoverable, so{moduleItemId}won't be replaced.Change to:
@get:PageViewUrlParam("moduleItemId") val moduleItemId by LongArg(key = RouterParams.MODULE_ITEM_ID, default = -1L)
-
EditSyllabusFragment—@PageViewUrlmethod returns a relative path, not a full URL
apps/teacher/src/main/java/com/instructure/teacher/features/syllabus/edit/EditSyllabusFragment.ktline 49PageViewAnnotationProcessor.getPageViewUrl()returns the@PageViewUrlmethod's result directly as the event URL with no further processing. All other@PageViewUrlimplementations return full URLs (e.g.assignment.htmlUrl,videoUri). The current implementation returns"/courses/${course.id}/syllabus/edit", so the tracked URL will be that literal relative path rather than a full URL.Change to:
fun makePageViewUrl(): String = "${ApiPrefs.fullDomain}/courses/${course.id}/syllabus/edit"
-
FileDetailsFragment— empty string fallback may produce a bad analytics event
apps/teacher/src/main/java/com/instructure/teacher/features/files/details/FileDetailsFragment.ktline 57If
makePageViewUrl()is called before the ViewModel has emitted data (fragment becomes visible before the async load completes),viewModel.data.value?.fileDatais null and the method returns"". That empty string is passed directly topageViewUtils.startEvent(...)and recorded as the page view URL.Consider using the
PageViewPrerequisites/completePageViewPrerequisitepattern (already in the codebase viaPageViewFragmentDelegate) to defer event recording until data is ready.
Positive notes
SpeedGraderFragment: correctly promotescourseId/assignmentIdto publicval— this is the right approach for@get:PageViewUrlParamto work via reflection, and it matches the pattern used byAssignmentDetailsFragment.SyllabusRepositoryFragment,ModuleListFragment,CalendarFragment,ElementaryDashboardFragment,NewDashboardFragment: simple@PageViewadditions with static URL strings look correct.AssignmentBasicFragment:@PageViewUrlreturningassignment.htmlUrl.orEmpty()correctly returns a full Canvas URL.
📊 Code Coverage Report✅ Student
✅ Teacher
✅ Pandautils
📈 Overall Average
|
|
@claude fix these
|
|
Claude finished @hermannakos's task in 1m 3s —— View job Fixed PageView annotation issues
|
- Remove private modifier from mStudentId/mCourseId in StudentContextFragment so @get:PageViewUrlParam is accessible via reflection - Remove private modifier from moduleItemId in ModuleProgressionFragment for the same reason - Use ApiPrefs.fullDomain in EditSyllabusFragment to return a full URL instead of a relative path Co-authored-by: Akos Hermann <[email protected]>
No description provided.