Skip to content
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
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# base image
FROM python:3.8

# setup environment variable for work directory
ENV FUSION_HOME=/home/app

# make work directory
RUN mkdir -p $FUSION_HOME

# set work directory
WORKDIR $FUSION_HOME

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# copy requirements file
COPY requirements.txt $FUSION_HOME

# install dependencies
RUN pip install --upgrade pip && pip install -r requirements.txt

# copy api directory to docker's work directory.
COPY . $FUSION_HOME

# Migrate all migrations
# RUN cd FusionIIIT && python manage.py migrate

# port where the Django app runs
EXPOSE 8000

# start server
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
35 changes: 30 additions & 5 deletions FusionIIIT/applications/academic_procedures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def academic_procedures_student(request):
year = demo_date.year

registers = get_student_register(user_details.id)
user_sem = get_user_semester(request.user, ug_flag, masters_flag, phd_flag)
# user_sem = get_user_semester(request.user, ug_flag, masters_flag, phd_flag)
user_branch = get_user_branch(user_details)

batch = obj.batch_id
Expand Down Expand Up @@ -297,8 +297,12 @@ def academic_procedures_student(request):
curr_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = obj.curr_semester_no)

try:
next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = obj.curr_semester_no+1)
semester_no = obj.curr_semester_no+1
next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = semester_no)
user_sem = semester_no

except Exception as e:
user_sem = get_user_semester(request.user, ug_flag, masters_flag, phd_flag)
next_sem_id = curr_sem_id

student_registration_check_pre = get_student_registrtion_check(obj,next_sem_id)
Expand All @@ -312,7 +316,7 @@ def academic_procedures_student(request):
if user_sem==2 and des_flag==False and ug_flag==True:
branchchange_flag=True

pre_registration_date_flag = get_pre_registration_eligibility(current_date)
pre_registration_date_flag = get_pre_registration_eligibility(current_date, user_sem, year)
final_registration_date_flag = get_final_registration_eligibility(current_date)
add_or_drop_course_date_flag = get_add_or_drop_course_date_eligibility(current_date)
pre_registration_flag = False
Expand All @@ -326,6 +330,7 @@ def academic_procedures_student(request):
final_registration_flag = student_registration_check_final.final_registration_flag

# print(">>>>>>>>>>>>>>>>>>>>>>",student_registration_check_pre.pre_registration_flag)

acad_year = get_acad_year(user_sem, year)
currently_registered_courses = get_currently_registered_courses(user_details.id, user_sem)

Expand Down Expand Up @@ -1214,9 +1219,29 @@ def phd_details(request):
def get_student_register(id):
return Register.objects.all().select_related('curr_id','student_id','curr_id__course_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id = id)

def get_pre_registration_eligibility(current_date):
def get_pre_registration_eligibility(current_date, user_sem, year):
'''
This function is used to extract the elgibility of pre-registration for a given semester
for a given year from the Calendar table.

@param:
current_date - current date at the user end
user_sem - current semester of the user(integer)
year - current year at the user end

@variables:
pre_registration_date - stores the object returned from calendar table for a given description
prd_start_date - holds start date of the pre registeration
prd_end_date - holds end date of the pre registration

#exception handling:
In case calendar table has no row for the given description pre_registration_date will store None value,
Therefore from_date and to_date attributes cannot be accessed so the function will return False.

'''
try:
pre_registration_date = Calendar.objects.all().filter(description="Pre Registration").first()
# pre_registration_date = Calendar.objects.all().filter(description="Pre Registration").first()
pre_registration_date = Calendar.objects.all().filter(description=f"Pre Registration {user_sem} {year}").first()
prd_start_date = pre_registration_date.from_date
prd_end_date = pre_registration_date.to_date
if current_date>=prd_start_date and current_date<=prd_end_date:
Expand Down
2 changes: 1 addition & 1 deletion FusionIIIT/templates/libraryModule/issuedItems.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<div class="ui active tab segment" data-tab="tab1content1">
<div class="ui vertical segment">
<div class="ui vertical segment" style="overflow:auto">
{% block tab1content1 %}
{% include 'libraryModule/issuedItems_content.html' %}
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion FusionIIIT/templates/libraryModule/libraryModule.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{% endblock %}
{% comment %}The user image card ends here!{% endcomment %}

<div class="ui divider"></div>
<div class="ui divider" style="max-width: 320px;"></div>

{% comment %}The Tab-Menu starts here!{% endcomment %}
<div class="ui huge fluid vertical pointing menu"
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,20 @@ The project now supports notifications across all modules. To implement notifica
module_notif(sender, receiver, type)
```
* The Notifications should then appear in the dashboard for the recipient

## Setting up Fusion using Docker
- Make sure you have docker & docker-compose setup properly.
- Update `FusionIIIT/Fusion/settings/development.py`
```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'fusiondb',
'HOST': os.environ.get("DB_HOST"),
'USER': 'fusionuser',
'PASSWORD': 'password',
}
}
```
- Run `docker-compose up`
- Once the server starts, run `sudo docker exec -i fusion_db_1 psql -U fusionuser -d fusiondb < path_to_db_dump`
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.9"
services:
db:
image: postgres:13-alpine
volumes:
- /private/var/lib/postgresql:/var/lib/postgresql
environment:
- POSTGRES_DB=fusiondb
- POSTGRES_USER=fusionuser
- POSTGRES_PASSWORD=password
ports:
- "5432:5432"
app:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/home/app
ports:
- 8000:8000
command: python FusionIIIT/manage.py runserver 0.0.0.0:8000
environment:
- DB_HOST=db
depends_on:
- db