Promote placement-pbi-v1 (placement cell module) to prod-test#1924
Merged
Conversation
fix: update current date retrieval in final registration page
fix: order courses by code in GenerateResultAPI
- Secured multiple views by adding @login_required to ensure only authenticated users can access them. - Updated views related to programmes, curriculums, courses, disciplines, batches, and course proposals.
Add login_required decorator to various views in programme_curriculum
… detailed batch information and dynamic filename generation for downloads
feat: enhance GenerateTranscriptForm and GenerateResultAPI to include detailed batch information and dynamic filename generation for downloads
…nloads with academic year and semester details
feat: update GenerateResultAPI to improve filename generation for downloads with academic year and semester details
Integrate the placement backend onto prod/acad-react (production-ready, API-only; legacy template code removed): - Replace template-based placement_cell with the API implementation (api/views.py, api/urls.py, selectors.py, services.py, serializers). - Point root urls.py placement include at placement_cell.api.urls. - Fix Education.grade max_length 3->10: the PR migration truncated existing CGPA values (e.g. '8.39') and failed on real data; keep production width. - Add migration 0013 to sync index names and updated_at with the models. - Remove ~2600 lines of legacy template-based views, their old routes, the dead forms import, the unused pdf_filters templatetag, and 16 orphaned placementModule templates. Keep cv.html (used by generate_cv_api) and the 5 templates shared with globals student-profile; keep forms.py (globals imports it). - manage.py check clean; all 47 API URLs resolve; migrations apply on DB. No settings or other modules changed.
- Add test_settings.py (outside the settings package) that disables migrations so the test DB builds from current models. The project's historical migrations do not apply on a fresh DB, which otherwise breaks test-DB creation for unrelated reasons. - Add test_placement_api.py: self-contained regression/contract tests (Education.grade width guard, API-only URL wiring, auth + role authz). - Fix the PR test fixtures: ExtraInfo is not auto-created here, so build it explicitly; grant self.officer the placement-officer role (denial tests use student/alumni users, so this is safe). This greens use_cases, business_rules and workflows. - Skip test_module.PlacementCellApiTests: it needs the globals dashboard notification API (NotificationList / Notification.module) absent on this branch; placement-scoped behaviour is covered by the other modules. - Declare PyYAML (spec-driven tests) and add tests/README.md. Result: 173 tests, OK (skipped=36). Run with --settings=test_settings.
- Add management command 'setup_placement_roles' that creates idempotent login accounts for the four placement roles (placement officer, placement chairman, student, alumni), wires HoldsDesignation and enables ModuleAccess.placement_cell so the sidebar shows the module per role. - Password is supplied at runtime (--password or PLACEMENT_ROLE_PASSWORD); it is never stored in the repo. - Document the roles, what each can do, role resolution and the role accounts in the placement README (without any password).
Add two additive features to the placement_cell API, ported from the job-board placement branch without disturbing the existing module: - PlacementAnnouncement: announcements readable by any authenticated role and posted/deleted by the TPO. - OffCampusPlacement: off-campus offers the TPO records against a student roll number. Adds the models (migration 0014), read/write serializers, role-gated API endpoints (/placement/api/announcements/, /placement/api/offcampus/) and regression tests covering authentication and role authorization.
Port the published-CPI logic from the job-board placement branch: compute a student's CPI from the examination module's latest *announced* result rather than the static Student.cpi snapshot. - selectors.get_student_published_cpi / batches_with_published_results - /placement/api/cpi-batches/ lists batches with an announced result - /placement/api/cpi-students/?batch_id= lists those students with their published CPI and off-campus companies; ?export=excel streams an .xls workbook (xlwt, matching the existing export). Both endpoints are restricted to TPO and chairman users. Adds contract tests covering authentication, role authorization and the Excel export.
Loading a batch's published CPI recomputed every student's CPI from the examination module on each request (several queries plus grade aggregation per student), making the Student CPI view slow for large batches. - Fetch the latest announced result once per batch instead of once per student. - Memoise each student's computed CPI in the cache keyed by roll number and semester; an announced semester's CPI does not change, so repeat loads of the same batch are served from cache. On a 49-student batch this cuts a reload from ~6s to ~0.02s. - Use memcached-safe cache keys (no spaces or colons).
Add /placement/api/branches/ returning the distinct academic department names students actually belong to. Branch eligibility compares a schedule's branch against the student's department name, so the placement-event form can populate its branch options from real data instead of a hard-coded list that had drifted (e.g. 'MECH'/'BDES' never matched the real 'ME'/'Design' departments, silently breaking branch eligibility).
Add a PlacementCalendarEvent model (migration 0015) plus endpoints so the placement cell can drop arbitrary entries onto the calendar (info sessions, deadlines, interview slots, notes): - GET /placement/api/calendar-events/ lists events for any authenticated user. - POST creates, PATCH/PUT updates and DELETE removes them, restricted to TPO and chairman users. Includes contract tests for authentication, role authorization and CRUD.
Coerce the batch_id query parameter to an integer before using it, so it can neither be reflected into the Content-Disposition filename nor reach the ORM filter as arbitrary input; a non-integer value now returns 400 instead of a 500.
Add a module README covering the role model, the full feature set per role, the backend models and grouped API endpoints, the published-CPI logic, the frontend module, the role-account setup command and how to run the tests.
Placement Cell: drives, applications, calendar, CPI, off-campus, announcements + docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promotes the placement-cell work from `placement-pbi-v1` to `prod-test`.
`placement-pbi-v1` is synced with current production (`prod/acad-react`, 0 behind) and adds the placement cell module:
Already merged to `placement-pbi-v1` via #1923.