Context switcher > Expose frecently visited namespaces in the GraphQL API
This is part of the work to move the frecently visited namespaces to the backend: &11957 (closed).
-
Implement the GraphQL resolvers to expose frecently visited namespaces via the API. - For every
entity_id
of auser_id
's visits (max 3 months old), for every 7 days, take the visits of that week. this is our "visits per week" frequency, an array looking like[14, 6, 1, 8, 16, 19, 6, 5, 9, 19, 0, 2, 7, 3]
. Let's say we have the oldest week on the left, and the current week on the right of the array. - We now score more recent weeks higher than older ones, by simply multiplying the number of visits per week (frequency) with their index in the array (
visits_per_weeks.each_with_index.map do |v,i| v*i; end
) which would give[0, 6, 2, 24, 64, 95, 36, 35, 72, 171, 0, 22, 84, 39]
- When we now do the
sum
on that array we get the project's final frecency score650
.
- For every
Edited by Paul Gascou-Vaillancourt