Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest staging #1652

Merged
merged 4 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 62 additions & 8 deletions FusionIIIT/applications/academic_procedures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,69 @@ def academic_procedures_faculty(request):
approved_assistantship_request_list = ta_approved_assistantship_request_list | thesis_approved_assistantship_request_list
mtechseminar_request_list = MTechGraduateSeminarReport.objects.all().filter(Overall_grade = '')
phdprogress_request_list = PhDProgressExamination.objects.all().filter(Overall_grade = '')
courses_list = list(CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter(instructor_id__id=fac_id.id).only('course_id__code', 'course_id__name', 'batch_id'))

assigned_courses = CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter(
instructor_id__id=fac_id.id, # Filter by faculty ID
batch_id__running_batch=True, # Filter by currently running batches
course_id__working_course=True # Filter by currently active courses
).only('course_id__code', 'course_id__name', 'batch_id')
assigned_courses = list(assigned_courses)

# courses_list = list(CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter(instructor_id__id=fac_id.id).only('course_id__code', 'course_id__name', 'batch_id'))
# print(fac_id.id)
courses_list = list(
CourseInstructor.objects.filter(instructor_id=fac_id.id)
.values('course_id_id','course_id__code','course_id__version','course_id__name', 'year', 'semester_no')
)
for course in courses_list:
# Calculate the batch as an integer
course['batch'] = int(course['year'] - (course['semester_no'] // 2))

# print(courses_list)
# # courses_list = list(
# CourseInstructor.objects.select_related('course_id', 'instructor_id')
# .filter(instructor_id=fac_id)
# # .only('course_id__code', 'course_id__name', 'course_id')
# )


# assigned_courses = CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter(
# instructor_id__id=fac_id.id, # Filter by faculty ID
# batch_id__running_batch=True, # Filter by currently running batches
# course_id__working_course=True # Filter by currently active courses
# ).only('course_id__code', 'course_id__name', 'batch_id')


course_years = (
CourseInstructor.objects
.select_related('course_id', 'instructor_id')
.filter(
instructor_id=fac_id.id,
course_id__working_course=True
)
)

assigned_courses = []
excluded_years = set()

for course_instructor in course_years:
# Calculate target year based on course year and semester
target_year = course_instructor.year - course_instructor.semester_no // 2

# Check if all batches for this target year are inactive
batches_for_year = Batch.objects.filter(year=target_year)
if batches_for_year.exists() and not batches_for_year.filter(running_batch=True).exists():
excluded_years.add(course_instructor.year)

# Second pass: filter courses based on excluded years
filtered_courses = (
CourseInstructor.objects
.select_related('course_id', 'instructor_id')
.filter(
instructor_id=fac_id.id,
course_id__working_course=True
)
.exclude(year__in=excluded_years)
)
# Ensure unique results in the final list
assigned_courses = list(filtered_courses)

# assigned_courses = list(assigned_courses)
# assigned_courses = []
# courses_list = []
# print('------------------------------------------------------------------------------------------------------------------' , list(assigned_courses))
r = range(4)
return render(
Expand Down
5 changes: 4 additions & 1 deletion FusionIIIT/applications/programme_curriculum/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from applications.globals.models import (DepartmentInfo, Designation,ExtraInfo, Faculty, HoldsDesignation)
from applications.filetracking.sdk.methods import *
from django.db.models import Q
from datetime import datetime

class ProgrammeForm(ModelForm):
class Meta:
Expand Down Expand Up @@ -386,6 +387,7 @@ def clean(self):
return self.cleaned_data

class CourseInstructorForm(forms.ModelForm):
next_year = datetime.now().year +1
course_id = forms.ModelChoiceField(
queryset=Course.objects.all(),
label="Select Course",
Expand All @@ -399,8 +401,9 @@ class CourseInstructorForm(forms.ModelForm):
empty_label="Choose an instructor",
widget=forms.Select(attrs={'class': 'ui fluid search selection dropdown'})
)

year = forms.ChoiceField(
choices=[('', 'Choose a year')] + [(year, year) for year in Batch.objects.values_list('year', flat=True).distinct()],
choices=[('', 'Choose a year')] + [(year, year) for year in Batch.objects.values_list('year', flat=True).distinct()]+[(next_year, next_year)],
label="Select Year",
widget=forms.Select(attrs={'class': 'ui fluid search selection dropdown'})
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-11-17 01:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('programme_curriculum', '0003_auto_20241115_1545'),
]

operations = [
migrations.AlterField(
model_name='courseslot',
name='type',
field=models.CharField(choices=[('Professional Core', 'Professional Core'), ('Professional Elective', 'Professional Elective'), ('Professional Lab', 'Professional Lab'), ('Engineering Science', 'Engineering Science'), ('Natural Science', 'Natural Science'), ('Humanities', 'Humanities'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('Management Science', 'Management Science'), ('Open Elective', 'Open Elective'), ('Swayam', 'Swayam'), ('Project', 'Project'), ('Optional', 'Optional'), ('Backlog', 'Backlog'), ('Others', 'Others')], max_length=70),
),
]
23 changes: 12 additions & 11 deletions FusionIIIT/templates/academic_procedures/academicfac.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@


<td colspan="2"><h4>Course Version</h4></td>
<td colspan="2"><h4>Programme</h4></td>
<td colspan="2"><h4>Working Year</h4></td>

<td colspan="2"><h4>Branch</h4></td>
<td colspan="2"><h4>Semester No</h4></td>
<!-- <td colspan="2"><h4>Year</h4></td> -->

<td colspan="2"><h4>Download Roll List</h4></td>
Expand All @@ -97,8 +97,8 @@
<td colspan="2"> {{course.course_id.name }}</td>
<td colspan="2"> {{course.course_id.code }}</td>
<td colspan="2"> {{course.course_id.version }}</td>
<td colspan="2"> {{course.batch_id.name }}</td>
<td colspan="2"> {{course.batch_id.discipline.name }}</td>
<td colspan="2"> {{course.year }}</td>
<td colspan="2"> {{course.semester_no }}</td>
<!-- <td colspan="2"> {{course.batch_id.year }}</td> -->

<!-- <td colspan="2"><a href="">Roll List</a></td> -->
Expand Down Expand Up @@ -127,18 +127,19 @@
<tr>
<th>Course Code</th>
<th>Name Of the Courses</th>
<th>Batch</th>
<th>working year</th>
<th>semester no</th>
</tr>
</thead>
<tbody>
{% for obj in courses_list %}
<tr>
<td><a href="{% url 'programme_curriculum:view_a_course' obj.course_id.id %}">{{obj.course_id.code}}</a></td>
<td>{{obj.course_id.name}}</td>
<td>{{ obj.batch_id.name}} {{obj.batch_id.year}}-{{obj.batch_id.discipline.name}}</td>
<td><a href="{% url 'programme_curriculum:view_a_course' obj.course_id_id %}">{{obj.course_id__code}}</a></td>
<td>{{obj.course_id__name}}</td>
<td>{{ obj.year}}</td>
<td>{{obj.semester_no}}</td>
<td class="collapsing"><a class="tiny ui positive animated button" tabindex="0"
href="{% url 'programme_curriculum:update_course_form' obj.course_id.id %}"
href="{% url 'programme_curriculum:update_course_form' obj.course_id_id %}"
type="Submit" name="Submit">
<div class="visible content">EDIT</div>
<div class="hidden content">
Expand All @@ -148,7 +149,7 @@
</td>
{%if items.0.type != "Swayam" %}
<td class="collapsing"><a class="tiny ui positive animated button" style="background:#2590e2;" tabindex="0"
href="{% url 'online_cms:course' obj.course_id.code obj.course_id.version %}"
href="{% url 'online_cms:course' obj.course_id__code obj.course_id__version %}"
type="Submit" name="Submit">
<div class="visible content">MANAGE</div>
<div class="hidden content">
Expand Down
4 changes: 2 additions & 2 deletions FusionIIIT/templates/account/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
<i class="right floated chevron right icon"></i>
</a>

<a class="item" href="/accounts/password/reset">
<!-- <a class="item" href="/accounts/password/reset">
Reset Password
<i class="right floated chevron right icon"></i>
</a>

<a class="item" href="/accounts/email">
Emails
<i class="right floated chevron right icon"></i>
</a>
</a> -->

</div>

Expand Down
4 changes: 2 additions & 2 deletions FusionIIIT/templates/account/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<div class="field">
<button class="ui fluid large primary button" type="submit">Login</button>
</div>
<div class="center aligned">
<!-- <div class="center aligned">
<a href="{% url 'account_reset_password' %}" style="color:white">{% trans "Forgot Password?" %}</a>
</div>
</div> -->
</form>

<div class="box-header with-border">
Expand Down