diff --git a/recruitment/__pycache__/views_frontend.cpython-312.pyc b/recruitment/__pycache__/views_frontend.cpython-312.pyc index a801254..7c33a4c 100644 Binary files a/recruitment/__pycache__/views_frontend.cpython-312.pyc and b/recruitment/__pycache__/views_frontend.cpython-312.pyc differ diff --git a/recruitment/views_frontend.py b/recruitment/views_frontend.py index f0b25cc..9b07a52 100644 --- a/recruitment/views_frontend.py +++ b/recruitment/views_frontend.py @@ -21,8 +21,15 @@ from django.contrib.messages.views import SuccessMessageMixin from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView # JobForm removed - using JobPostingForm instead from django.urls import reverse_lazy -from django.db.models import Q, Count, Avg from django.db.models import FloatField +from django.db.models import F, IntegerField, Count, Avg, Sum, Q, ExpressionWrapper, fields +from django.db.models.functions import Cast, Coalesce, TruncDate +from django.contrib.auth.decorators import login_required +from django.shortcuts import render +from django.utils import timezone +from datetime import timedelta +import json + from datastar_py.django import ( DatastarResponse, @@ -339,13 +346,6 @@ class TrainingDeleteView(LoginRequiredMixin, SuccessMessageMixin, DeleteView): success_url = reverse_lazy('training_list') success_message = 'Training material deleted successfully.' -from django.db.models import F, IntegerField, Count, Avg, Sum, Q, ExpressionWrapper, fields -from django.db.models.functions import Cast, Coalesce, TruncDate -from django.contrib.auth.decorators import login_required -from django.shortcuts import render -from django.utils import timezone -from datetime import timedelta -import json # IMPORTANT: Ensure 'models' correctly refers to your Django models file # Example: from . import models @@ -494,11 +494,12 @@ def dashboard_view(request): # A. Pipeline Funnel (Scoped) stage_counts = candidate_queryset.values('stage').annotate(count=Count('stage')) stage_map = {item['stage']: item['count'] for item in stage_counts} - candidate_stage = ['Applied', 'Exam', 'Interview', 'Offer', 'HIRED'] + candidate_stage = ['Applied', 'Exam', 'Interview', 'Offer', 'Hired'] candidates_count = [ stage_map.get('Applied', 0), stage_map.get('Exam', 0), stage_map.get('Interview', 0), - stage_map.get('Offer', 0), filled_positions + stage_map.get('Offer', 0), stage_map.get('Hired',0) ] + # --- 7. GAUGE CHART CALCULATION (Time-to-Hire) ---