Commit 1229c12a authored by Darshan Prabhu's avatar Darshan Prabhu

Updated views file to sort data in ascending order

parent 85e6dc13
No preview for this file type
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
\setlength{\tabcolsep}{1in}% \setlength{\tabcolsep}{1in}%
\begin{longtabu}{|c c|}% \begin{longtabu}{|c c|}%
\hline% \hline%
\textbf{No. of Students applied}&3\\% \textbf{No. of Students applied}&4\\%
\textbf{No. of Slots Offered}&4\\% \textbf{No. of Slots Offered}&16\\%
\textbf{No. of Students alloted}&2\\% \textbf{No. of Students alloted}&3\\%
\hline% \hline%
\end{longtabu}% \end{longtabu}%
\renewcommand{\arraystretch}{2.0}% \renewcommand{\arraystretch}{2.0}%
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
\textbf{Guide Name}&\textbf{Requirements}&\textbf{Alloted}\\% \textbf{Guide Name}&\textbf{Requirements}&\textbf{Alloted}\\%
\hline% \hline%
\hline% \hline%
Faculty 1&4&\textbf{2}\\% Faculty 1&11&\textbf{3}\\%
\hline%
Faculty 2&5&\textbf{0}\\%
\hline% \hline%
\end{longtabu}% \end{longtabu}%
\begin{center}% \begin{center}%
...@@ -54,17 +56,36 @@ Faculty 1&4&\textbf{2}\\% ...@@ -54,17 +56,36 @@ Faculty 1&4&\textbf{2}\\%
\midrule% \midrule%
\midrule% \midrule%
\endhead% \endhead%
\multirow{2}{*}{Faculty 1}&\multirow{2}{*}{1}&1&darshan\\% \multirow{3}{*}{Faculty 1}&\multirow{2}{*}{1}&3&student{-}2\\%
\cmidrule{3% \cmidrule{3%
-% -%
4}% 4}%
&&2&student{-}1\\% &&6&student{-}3\\%
\cmidrule{3%
-%
4}%
\cmidrule{2%
-%
4}%
&\multirow{1}{*}{2}&2&student{-}4\\%
\cmidrule{3% \cmidrule{3%
-% -%
4}% 4}%
\cmidrule{2% \cmidrule{2%
-% -%
4}% 4}%
\cmidrule{2%
-%
4}%
\cmidrule{1%
-%
4}%
\cmidrule{2%
-%
4}%
\cmidrule{2%
-%
4}%
\cmidrule{1% \cmidrule{1%
-% -%
4}\bottomrule% 4}\bottomrule%
......
...@@ -296,8 +296,9 @@ def updatePriorityView(request): ...@@ -296,8 +296,9 @@ def updatePriorityView(request):
project_id = request.POST.get('projectId') project_id = request.POST.get('projectId')
clauses = ' '.join(['WHEN student_id={} THEN {}'.format(pk, i) for i, pk in enumerate(priority_list)]) clauses = ' '.join(['WHEN student_id={} THEN {}'.format(pk, i) for i, pk in enumerate(priority_list)])
ordering = 'CASE {} END'.format(clauses) ordering = 'CASE {} END'.format(clauses)
print(clauses)
priorities = ProjectPriorities.objects.filter(project_id=project_id).extra(select={'ordering': ordering}, order_by=('ordering',)) priorities = ProjectPriorities.objects.filter(project_id=project_id).extra(select={'ordering': ordering}, order_by=('ordering',))
print(priorities)
if priorities.exists(): if priorities.exists():
for index,priority in enumerate(priorities): for index,priority in enumerate(priorities):
# Update priorities # Update priorities
...@@ -439,6 +440,7 @@ def get_context(user_type,request): ...@@ -439,6 +440,7 @@ def get_context(user_type,request):
current_round = RoundDetailsModel.objects.latest('roundNo') current_round = RoundDetailsModel.objects.latest('roundNo')
context['current_round'] = current_round context['current_round'] = current_round
if user_type == 'student': if user_type == 'student':
print(request.POST)
# Get student context details # Get student context details
# User application with all student details # User application with all student details
...@@ -508,7 +510,7 @@ def get_context(user_type,request): ...@@ -508,7 +510,7 @@ def get_context(user_type,request):
# List of all priorities associated with each project # List of all priorities associated with each project
priority_groups = dict() priority_groups = dict()
for priority in ProjectPriorities.objects.filter(project__in=context['availablePositions']).order_by('-current_priority'): for priority in ProjectPriorities.objects.filter(project__in=context['availablePositions']).order_by('current_priority'):
priority_groups.setdefault(priority.project,[]).append(priority) priority_groups.setdefault(priority.project,[]).append(priority)
context['ProjectWiseShortlistedApplications'] = list(priority_groups.values()) context['ProjectWiseShortlistedApplications'] = list(priority_groups.values())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment