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

feat(course_registration): Added option to add course for any sem #1660

Merged
merged 1 commit into from
Dec 1, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-12-01 16:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('academic_procedures', '0003_finalregistration_registration_type'),
]

operations = [
migrations.AddField(
model_name='course_registration',
name='registration_type',
field=models.CharField(choices=[('Audit', 'Audit'), ('Improvement', 'Improvement'), ('Backlog', 'Backlog'), ('Regular', 'Regular')], default='Regular', max_length=20),
),
]
11 changes: 11 additions & 0 deletions FusionIIIT/applications/academic_procedures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,17 @@ class course_registration(models.Model):
semester_id = models.ForeignKey(Semester, on_delete=models.CASCADE)
course_id = models.ForeignKey(Courses, on_delete=models.CASCADE)
course_slot_id = models.ForeignKey(CourseSlot, null=True, blank=True, on_delete=models.SET_NULL)
REGISTRATION_TYPE_CHOICES = [
('Audit', 'Audit'),
('Improvement', 'Improvement'),
('Backlog', 'Backlog'),
('Regular', 'Regular'),
]
registration_type = models.CharField(
max_length=20,
choices=REGISTRATION_TYPE_CHOICES,
default='Regular',
)
# grade = models.CharField(max_length=10)
#course_registration_year = models.IntegerField()
def __str__(self):
Expand Down
30 changes: 20 additions & 10 deletions FusionIIIT/applications/academic_procedures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ def academic_procedures_student(request):
next_sem_registration_courses = get_sem_courses(next_sem_id, batch)
final_registration_choice, unavailable_courses_nextsem = get_final_registration_choices(next_sem_registration_courses,batch.year)
currently_registered_course = get_currently_registered_course(obj,obj.curr_semester_no)
current_courseregistrations = get_currently_registered_course(obj,obj.curr_semester_no, True)

current_credits = get_current_credits(currently_registered_course)

Expand Down Expand Up @@ -562,6 +563,7 @@ def academic_procedures_student(request):
{'details': details,
# 'calendar': calendar,
'currently_registered': currently_registered_course,
'current_courseregistrations': current_courseregistrations,
'pre_registered_course' : pre_registered_courses,
'pre_registered_course_show' : pre_registered_course_show,
'final_registered_course' : final_registered_courses,
Expand Down Expand Up @@ -1048,14 +1050,15 @@ def verify_course(request):
details = []

current_sem_courses = get_currently_registered_course(
roll_no, curr_sem_id)
roll_no, curr_sem_id, True)

idd = obj2
for z in current_sem_courses:
z = z[1]
# print(z)
# z = z[1]
print(z)
course_code = z.code
course_name = z.name
course_code = z.course_id.code
course_name = z.course_id.name
# course_code, course_name = str(z).split(" - ")
k = {}
# reg_ig has course registration id appended with the the roll number
Expand All @@ -1068,8 +1071,9 @@ def verify_course(request):
for p in courseobj2:
k['course_id'] = course_code
k['course_name'] = course_name
k['sem'] = curr_sem_id.semester_no
k['sem'] = z.semester_id.semester_no
k['credits'] = p.credit
k['registration_type'] = z.registration_type
details.append(k)

year = demo_date.year
Expand Down Expand Up @@ -1111,8 +1115,9 @@ def acad_add_course(request):
'id', 'id__user', 'id__department').filter(id=roll_no).first()
sem_id = request.POST['semester_id']
semester = Semester.objects.get(id=sem_id)
registration_type = request.POST["registration_type"]
cr = course_registration(
course_id=course, student_id=student, semester_id=semester , working_year = datetime.datetime.now().year,)
course_id=course, student_id=student, semester_id=semester , working_year = datetime.datetime.now().year, registration_type=registration_type)
cr.save()

return HttpResponseRedirect('/academic-procedures/')
Expand Down Expand Up @@ -2104,12 +2109,17 @@ def get_currently_registered_courses(id, user_sem):
ans.append(course)
return ans

def get_currently_registered_course(id, sem_id):
# obj = course_registration.objects.all().filter(student_id = id, semester_id=sem_id)
obj = course_registration.objects.all().filter(student_id = id)
def get_currently_registered_course(id, sem_id, courseregobj=False):
if (type(sem_id) == int):
obj = course_registration.objects.all().filter(student_id = id, semester_id__semester_no=sem_id)
else:
obj = course_registration.objects.all().filter(student_id = id)
courses = []
for i in obj:
courses.append((i.course_slot_id,i.course_id))
if (courseregobj):
courses.append(i)
else:
courses.append((i.course_slot_id,i.course_id))
return courses


Expand Down
14 changes: 9 additions & 5 deletions FusionIIIT/templates/academic_procedures/current_sem.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,32 @@
<th style="width: 13%"><center>Course ID</center></th>
<th style="width: 50%"><center>Course Name</center></th>
<th style="width: 10%"><center>Credits</center></th>
<th style="width: 10%"><center>Registration Type</center></th>
<th style="width: 10%"><center>Semester</center></th>
</tr>
</thead>

<tbody>
{% for items in currently_registered %}
{% for items in current_courseregistrations %}
<tr>
<td><center>{{ forloop.counter }} .</center></td>
<td><center>
<a href="{% url 'programme_curriculum:view_a_course' items.1.id %}">{{ items.1.code }}</a>
<a href="{% url 'programme_curriculum:view_a_course' items.course_id.id %}">{{ items.course_id.code }}</a>
</td>
<td>
{{ items.1.name}}
{{ items.course_id.name}}
</td>
<td>
<center>{{ items.1.credit }}</center>
<center>{{ items.course_id.credit }}</center>
</td>
<td>
<center>{{ items.registration_type }}</center>
</td>
<td>
<center>{{curr_sem.semester_no}}</center>
</td>
<!-- <td class="collapsing"><a class="tiny ui positive animated button" style="background:#2590e2;" tabindex="0"
href="{% url 'online_cms:course' items.1.code items.1.version %}"
href="{% url 'online_cms:course' items.course_id.code items.course_id.version %}"
type="Submit" name="Submit">
<div class="visible content">MANAGE</div>
<div class="hidden content">
Expand Down
17 changes: 16 additions & 1 deletion FusionIIIT/templates/academic_procedures/studentCourses.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<th>
Semester
</th>
<th>
Registration Type
</th>
<th>
Drop Course
</th>
Expand Down Expand Up @@ -100,6 +103,9 @@
<td>
{{ items.sem }}
</td>
<td>
{{ items.registration_type }}
</td>
<td>
<A class="ui blue label"
href="/academic-procedures/acad_person/verifyCourse/drop/?id={{ items.reg_id|urlencode }}" onclick="courseDropCalled(event)" >
Expand All @@ -123,7 +129,7 @@
{% endif %}

<div class="ui divider"></div>
{% comment %} <button class="ui fluid positive button addCourseButton">Add Course</button> {% endcomment %}
<button class="ui fluid positive button addCourseButton">Add Course</button>

<div class="ui modal addCourseForm">
<p>Fill details for the Course you want to add</p>
Expand All @@ -147,6 +153,15 @@
{% endfor%}
</select>
</div>
<div class="field">
<label>Registration Type</label>
<select class="ui fluid dropdown" name = "registration_type">
<option value="Regular">Regular</option>
<option value="Improvement">Improvement</option>
<option value="Backlog">Backlog</option>
<option value="Audit">Audit</option>
</select>
</div>

<input type = "text" value = {{dict2.roll_no}} name="roll_no" hidden/>
<button class="ui fluid positive button" type="submit" name = "AddCourse" value = "submit">Add Course</button>
Expand Down