feat: replace pipeline profile and source health
This commit is contained in:
@@ -6,6 +6,8 @@ from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import ListView, UpdateView
|
||||
|
||||
from apps.jobs.models import JobPosting, ScoreRun
|
||||
|
||||
from .forms import SearchProfileForm
|
||||
from .models import SearchProfile
|
||||
from .services import resolve_profile_home_location, save_profile_revision
|
||||
@@ -29,6 +31,21 @@ class ProfileUpdateView(LoginRequiredMixin, UpdateView):
|
||||
def get_queryset(self):
|
||||
return SearchProfile.objects.filter(user=self.request.user)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["preview_score"] = (
|
||||
ScoreRun.objects.filter(
|
||||
profile=self.object,
|
||||
job__status=JobPosting.Status.ACTIVE,
|
||||
hard_exclusions=[],
|
||||
)
|
||||
.select_related("job", "job__employer")
|
||||
.order_by("-created_at")
|
||||
.first()
|
||||
)
|
||||
context["recent_revisions"] = list(self.object.revisions.all()[:4])
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
response = super().form_valid(form)
|
||||
location_result = resolve_profile_home_location(self.object)
|
||||
|
||||
Reference in New Issue
Block a user