Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Rex Dri Rex Dri
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 33
    • Issues 33
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Rex Dri
  • Rex DriRex Dri
  • Issues
  • #149
Closed
Open
Issue created Jul 19, 2019 by Florent Chehab@chehabflOwner

Last visited universities

#149 (closed)

Backend:

  1. Create an intermediate model (LastVisitedUniversity) between the user and university models
    • This model contains 3 fields : one for user (foreign key) , one for university (foreign key) and one for lastClickOnUniversity (DateTimeField: auto_now = True)
  2. Create a viewset to update the previous model when a user looks at a university (get inspired by https://gitlab.utc.fr/rex-dri/rex-dri/-/blob/dev/backend/backend_app/viewsets.py#L316).

Endpoint: /lastVisitedUniversities req POST endpoint/<pk_univ> => Create LastVisitedUniversity(user=req.user, university=University.get(pk=<pk_univ>), ts=now()) req GET endpoint => return List[LastVisitedUniversity.where(user=req.user).orderby(ts DESC).first(5)] (list[int] === List[<pk_univ>]) SQL:

SELECT university, max(ts) as ts
FROM LastVisitedUniversity
WHERE 
    USER = <req.user.pk>
GROUP BY university
ORDER BY ts DESC
LIMIT 5;

other => Return 404

Frontend:

  1. When visiting university: make POST request (https://gitlab.utc.fr/rex-dri/rex-dri/-/blob/dev/frontend/src/components/recommendation/view/View.jsx#L676 use the useApiCreate() hook)
  2. Create component to show last visited univ (and mention REX-DRI private)
Edited May 17, 2020 by Florent Chehab
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking