Compare commits
61 Commits
manzilchec
...
main
Author | SHA1 | Date |
---|---|---|
|
3a4cfbc897 | 6 months ago |
|
8860907d80 | 6 months ago |
|
92ae578bdb | 6 months ago |
|
8dd5b8fca2 | 6 months ago |
|
0a17fbba45 | 6 months ago |
|
9f19445301 | 6 months ago |
|
3f777b170d | 6 months ago |
|
88b4537b4a | 6 months ago |
|
15accb4385 | 6 months ago |
|
cd9253b19b | 6 months ago |
|
1c85702154 | 6 months ago |
|
5041d84363 | 6 months ago |
|
ac5813a0de | 6 months ago |
|
8d0ae7769a | 6 months ago |
|
c603e293da | 6 months ago |
|
5abe922b98 | 6 months ago |
|
31caf3d052 | 6 months ago |
|
8c029cbe14 | 6 months ago |
|
607902fd48 | 6 months ago |
|
db1c835920 | 6 months ago |
|
e4877a54e3 | 6 months ago |
|
4b622f15c3 | 6 months ago |
|
5db8102fec | 6 months ago |
|
3741dbc38a | 6 months ago |
|
716e5cffb4 | 6 months ago |
|
f16bb5862e | 6 months ago |
|
4169e265ab | 6 months ago |
|
da3204380d | 6 months ago |
|
8113aa2051 | 6 months ago |
|
5ab4e24ece | 6 months ago |
|
2d6dfb0695 | 6 months ago |
|
8b7fe2dc6c | 6 months ago |
|
c16cf0f216 | 6 months ago |
|
bec6c10e08 | 6 months ago |
|
d1e64a7eca | 6 months ago |
|
7f3ba4fb65 | 6 months ago |
|
14789498f0 | 6 months ago |
|
f477cc5577 | 6 months ago |
|
4dc8d6ab64 | 6 months ago |
|
e6122c3536 | 6 months ago |
|
4d0d8b94f6 | 6 months ago |
|
187754261f | 6 months ago |
|
8c46f2a61a | 6 months ago |
|
5a29dff433 | 6 months ago |
|
3dbbeebd59 | 6 months ago |
|
ef35036bc5 | 6 months ago |
|
057e9c9043 | 6 months ago |
|
a80995b170 | 6 months ago |
|
a6d03971eb | 6 months ago |
|
7852c8c559 | 6 months ago |
|
c51d14f1b0 | 6 months ago |
|
8016d489bd | 6 months ago |
|
6afb2a7cfb | 6 months ago |
|
e3ffa28c35 | 6 months ago |
|
e70d869b76 | 6 months ago |
|
b8bbe33815 | 6 months ago |
|
43b82377e9 | 6 months ago |
|
6d9cb1bbb3 | 6 months ago |
|
2520dc3cce | 6 months ago |
|
7a5ff71010 | 6 months ago |
|
99c0411370 | 6 months ago |
@ -1,152 +1,48 @@ |
|||||||
from flask import Blueprint, request, jsonify, g |
from flask import Blueprint, url_for, jsonify, g |
||||||
from werkzeug.datastructures import MultiDict |
from utils.auth import auth_required |
||||||
import os |
from db.model import db, Badge, UserBadge |
||||||
import uuid |
|
||||||
from sqlalchemy import select |
from sqlalchemy import select |
||||||
from config import DEFAULT_BADGE_ICON, USER_UPLOADS_DIR |
badge_route = Blueprint('badge', __name__) |
||||||
from db.model import db, Badge, User |
|
||||||
from utils.utils import random_string_generator |
@badge_route.route('/listAllBadges') |
||||||
from utils.auth import auth_required, requires_role |
def all_badges(): |
||||||
from constants import UserRole |
badges: list[Badge] = db.session.execute(select(Badge)).scalars() |
||||||
|
data: list = [] |
||||||
badge = Blueprint('badge', __name__) |
for bgd in badges: |
||||||
|
data.append({ |
||||||
@badge.route('/create', methods=['POST']) |
'id': bgd.id, |
||||||
@auth_required() |
'name': bgd.name, |
||||||
@requires_role([UserRole.ADMIN]) |
'description': bgd.description, |
||||||
def create_badge(): |
'createDate': bgd.createDate, |
||||||
""" |
'icon': url_for('send_file', filename=bgd.icon), |
||||||
Create a new badge. Only accessible by admin users. |
'canClaim': bgd.canClaim |
||||||
Requires: badge_name, description |
}) |
||||||
Optional: icon_image, can_claim |
|
||||||
""" |
|
||||||
try: |
|
||||||
form_data: dict = request.form |
|
||||||
badge_uploaded_icon: MultiDict|None = request.files.get('icon_image', None) |
|
||||||
|
|
||||||
# Validate required fields |
|
||||||
try: |
|
||||||
badge_name: str = form_data['badge_name'] |
|
||||||
if len(badge_name) > 16: |
|
||||||
return jsonify({'message': 'Badge name cannot exceed 16 characters'}), 400 |
|
||||||
except KeyError: |
|
||||||
return jsonify({'message': 'Badge name cannot be empty'}), 400 |
|
||||||
|
|
||||||
# Handle icon upload |
|
||||||
icon_file_name: str = DEFAULT_BADGE_ICON |
|
||||||
if badge_uploaded_icon is not None: |
|
||||||
icon_file_name = f"{random_string_generator(32)}.{badge_uploaded_icon.filename.split('.')[-1]}" |
|
||||||
badge_uploaded_icon.save(os.path.join(USER_UPLOADS_DIR, icon_file_name)) |
|
||||||
|
|
||||||
# Get optional fields |
|
||||||
badge_description: str = form_data.get('description', '') |
|
||||||
can_claim: bool = form_data.get('can_claim', 'false').lower() == 'true' |
|
||||||
|
|
||||||
# Create new badge |
|
||||||
new_badge: Badge = Badge( |
|
||||||
name=badge_name, |
|
||||||
description=badge_description, |
|
||||||
icon=icon_file_name, |
|
||||||
canClaim=can_claim, |
|
||||||
user_badges=[] |
|
||||||
) |
|
||||||
|
|
||||||
db.session.add(new_badge) |
|
||||||
db.session.commit() |
|
||||||
|
|
||||||
return jsonify({ |
return jsonify({ |
||||||
'message': 'Badge was created successfully.', |
'count': len(data), |
||||||
'badge': { |
'data': data |
||||||
'id': str(new_badge.id), |
}) |
||||||
'name': new_badge.name, |
|
||||||
'description': new_badge.description, |
|
||||||
'icon': new_badge.icon, |
|
||||||
'canClaim': new_badge.canClaim |
|
||||||
} |
|
||||||
}), 200 |
|
||||||
|
|
||||||
except Exception as e: |
@badge_route.route('/myBadges') |
||||||
db.session.rollback() |
|
||||||
return jsonify({'message': f'An error occurred: {str(e)}'}), 500 |
|
||||||
|
|
||||||
@badge.route('/update/<badge_id>', methods=['PUT']) |
|
||||||
@auth_required() |
@auth_required() |
||||||
@requires_role([UserRole.ADMIN]) |
def my_badges(): |
||||||
def update_badge(badge_id): |
user_badges: list[UserBadge] = db.session.execute(select(UserBadge).where( |
||||||
""" |
UserBadge.userID == g.current_user.id |
||||||
Update an existing badge. Only accessible by admin users. |
)).scalars() |
||||||
""" |
data: list = [] |
||||||
try: |
for ub in user_badges: |
||||||
badge_to_update = db.session.get(Badge, uuid.UUID(badge_id)) |
bgd = ub.badge |
||||||
if not badge_to_update: |
data.append({ |
||||||
return jsonify({'message': 'Badge not found'}), 404 |
'id': ub.id, |
||||||
|
'badgeID': bgd.id, |
||||||
form_data: dict = request.form |
'userID': ub.userID, |
||||||
badge_uploaded_icon: MultiDict|None = request.files.get('icon_image', None) |
'name': bgd.name, |
||||||
|
'description': bgd.description, |
||||||
# Update icon if provided |
'createDate': bgd.createDate, |
||||||
if badge_uploaded_icon is not None: |
'icon': url_for('send_file', filename=bgd.icon), |
||||||
new_icon_name = f"{random_string_generator(32)}.{badge_uploaded_icon.filename.split('.')[-1]}" |
'canClaim': bgd.canClaim, |
||||||
badge_uploaded_icon.save(os.path.join(USER_UPLOADS_DIR, new_icon_name)) |
'claimedDate': ub.claimedDate, |
||||||
# Remove old icon if it's not the default |
}) |
||||||
if badge_to_update.icon != DEFAULT_BADGE_ICON: |
|
||||||
try: |
|
||||||
os.remove(os.path.join(USER_UPLOADS_DIR, badge_to_update.icon)) |
|
||||||
except OSError: |
|
||||||
pass # File might not exist |
|
||||||
badge_to_update.icon = new_icon_name |
|
||||||
|
|
||||||
# Update other fields if provided |
|
||||||
if 'badge_name' in form_data: |
|
||||||
if len(form_data['badge_name']) > 16: |
|
||||||
return jsonify({'message': 'Badge name cannot exceed 16 characters'}), 400 |
|
||||||
badge_to_update.name = form_data['badge_name'] |
|
||||||
|
|
||||||
if 'description' in form_data: |
|
||||||
badge_to_update.description = form_data['description'] |
|
||||||
|
|
||||||
if 'can_claim' in form_data: |
|
||||||
badge_to_update.canClaim = form_data['can_claim'].lower() == 'true' |
|
||||||
|
|
||||||
db.session.commit() |
|
||||||
|
|
||||||
return jsonify({ |
return jsonify({ |
||||||
'message': 'Badge was updated successfully.', |
'count': len(data), |
||||||
'badge': { |
'data': data |
||||||
'id': str(badge_to_update.id), |
}) |
||||||
'name': badge_to_update.name, |
|
||||||
'description': badge_to_update.description, |
|
||||||
'icon': badge_to_update.icon, |
|
||||||
'canClaim': badge_to_update.canClaim |
|
||||||
} |
|
||||||
}), 200 |
|
||||||
|
|
||||||
except Exception as e: |
|
||||||
db.session.rollback() |
|
||||||
return jsonify({'message': f'An error occurred: {str(e)}'}), 500 |
|
||||||
|
|
||||||
@badge.route('/list', methods=['GET']) |
|
||||||
@auth_required() |
|
||||||
def list_badges(): |
|
||||||
""" |
|
||||||
List all badges. Accessible by all authenticated users. |
|
||||||
""" |
|
||||||
try: |
|
||||||
badges = db.session.execute( |
|
||||||
select(Badge) |
|
||||||
.order_by(Badge.createDate.desc()) |
|
||||||
).scalars().all() |
|
||||||
|
|
||||||
return jsonify({ |
|
||||||
'badges': [{ |
|
||||||
'id': str(badge.id), |
|
||||||
'name': badge.name, |
|
||||||
'description': badge.description, |
|
||||||
'icon': badge.icon, |
|
||||||
'canClaim': badge.canClaim, |
|
||||||
'createDate': badge.createDate.isoformat() |
|
||||||
} for badge in badges] |
|
||||||
}), 200 |
|
||||||
|
|
||||||
except Exception as e: |
|
||||||
return jsonify({'message': f'An error occurred: {str(e)}'}), 500 |
|
@ -1,56 +1,569 @@ |
|||||||
from flask import Blueprint, request, jsonify, g |
from flask import Blueprint, request, jsonify, g, url_for |
||||||
|
from sqlalchemy import select, and_, func, distinct, or_ |
||||||
|
from sqlalchemy.exc import IntegrityError |
||||||
from werkzeug.datastructures import MultiDict |
from werkzeug.datastructures import MultiDict |
||||||
import os |
import os |
||||||
import uuid |
import uuid |
||||||
|
import math |
||||||
from config import DEFAULT_COURSE_COVER |
from config import DEFAULT_COURSE_COVER |
||||||
from db.model import db, Course, Category, User, Chat |
from db.model import db, Course, Category, User, Chat, Enrollment |
||||||
from utils.utils import random_string_generator |
from utils.utils import random_string_generator, split_pdf_into_pages_with_text |
||||||
from utils.auth import auth_required, requires_role |
from utils.auth import auth_required, requires_role |
||||||
from constants import * |
from constants import * |
||||||
from config import * |
from config import * |
||||||
from constants import PublishedStatus |
from constants import PublishedStatus |
||||||
|
from typing import Union |
||||||
|
from db.model import UserRole |
||||||
|
|
||||||
course = Blueprint('course', __name__) |
course = Blueprint('course', __name__) |
||||||
|
|
||||||
@course.route('/create', methods=['POST']) |
@course.route('/listAll') |
||||||
|
def list_all_courses(): |
||||||
|
limit: int = int(request.args.get('limit', 10)) |
||||||
|
offset: int = int(request.args.get('offset', 0)) |
||||||
|
category_uuid: str = request.args.get('category_uuid') |
||||||
|
search_q: str = request.args.get('search_q', '').strip() |
||||||
|
sort_by: str = request.args.get('sort_by', '').strip() |
||||||
|
show_pending: bool = bool(int(request.args.get('show_pending', 0))) |
||||||
|
available_sorts = ['date_asc', 'date_desc', 'name_asc', 'name_desc', 'students_desc', 'students_asc'] |
||||||
|
if category_uuid is not None: |
||||||
|
category_uuid: uuid.UUID = uuid.UUID(request.args.get('category_uuid')) |
||||||
|
# Build the query as required |
||||||
|
query: select = select(Course) |
||||||
|
if search_q != '': |
||||||
|
query = query.where(or_(Course.name.like(f'%{search_q}%'), Course.description.like(f'%{search_q}%'), |
||||||
|
User.firstName.like(f'%{search_q}%'))) |
||||||
|
if category_uuid is not None: |
||||||
|
query = query.where(Course.categoryID == category_uuid) |
||||||
|
if g.get('is_authed'): |
||||||
|
if show_pending and g.current_user.role == int(UserRole.ADMIN): |
||||||
|
query = query.where(Course.publishedStatus == int(PublishedStatus.PENDING)) |
||||||
|
else: |
||||||
|
query = query.where(Course.publishedStatus == int(PublishedStatus.APPROVED)) |
||||||
|
#total_pages_for_offset: int = db.session.execute(func.count(Course.id).select_from(Course)).scalar()/limit |
||||||
|
total_pages_for_offset: int = db.session.execute( |
||||||
|
select(func.count()).select_from(query.subquery()) |
||||||
|
).scalar() / limit |
||||||
|
|
||||||
|
query = query.limit(limit).offset(offset) |
||||||
|
total_pages: int = math.ceil(total_pages_for_offset) |
||||||
|
if sort_by in available_sorts: |
||||||
|
if sort_by == 'date_asc': |
||||||
|
query = query.order_by(Course.creationDate.asc()) |
||||||
|
elif sort_by == 'date_desc': |
||||||
|
query = query.order_by(Course.creationDate.desc()) |
||||||
|
elif sort_by == 'name_asc': |
||||||
|
query = query.order_by(Course.name.asc()) |
||||||
|
elif sort_by == 'name_desc': |
||||||
|
query = query.order_by(Course.name.desc()) |
||||||
|
elif sort_by == 'students_desc': |
||||||
|
query = query.order_by(Course.totalEnrolled.desc()) |
||||||
|
elif sort_by == 'students_asc': |
||||||
|
query = query.order_by(Course.totalEnrolled.asc()) |
||||||
|
courses: list[Course] = db.session.execute(query).scalars() |
||||||
|
course_list: list[dict] = [] |
||||||
|
for item in courses: |
||||||
|
course_list.append( |
||||||
|
{ |
||||||
|
'id': item.id, |
||||||
|
'name': item.name, |
||||||
|
'description': item.description, |
||||||
|
'isActive': item.isActive, |
||||||
|
'creationDate': item.creationDate, |
||||||
|
'coverImage': url_for('send_file', filename=item.coverImage), |
||||||
|
'totalEnrolled': item.totalEnrolled, |
||||||
|
'pdf0': url_for('send_file', filename=item.serverFilename), |
||||||
|
'author': { |
||||||
|
'id': item.author.id, |
||||||
|
'firstName': item.author.firstName, |
||||||
|
'lastName': item.author.lastName, |
||||||
|
'username': item.author.username, |
||||||
|
'bio': item.author.bio, |
||||||
|
'lastOnline': item.author.lastOnline, |
||||||
|
'pfpFilename': url_for('send_file', filename=item.author.pfpFilename) |
||||||
|
}, |
||||||
|
'category': { |
||||||
|
'id': item.categoryID, |
||||||
|
'name': item.category.name, |
||||||
|
'description': item.category.description |
||||||
|
} |
||||||
|
}) |
||||||
|
return jsonify({ |
||||||
|
'total_pages': total_pages, |
||||||
|
'current_offset': offset, |
||||||
|
'limit': limit, |
||||||
|
'data': course_list, |
||||||
|
}) |
||||||
|
|
||||||
|
@course.route('/enroll',methods=['POST']) |
||||||
|
@auth_required() |
||||||
|
def enroll_user(): |
||||||
|
if not request.form.get('course_uuid'): |
||||||
|
return jsonify({'message': 'Missing required parameter "course_uuid" '}), 400 |
||||||
|
course_uuid: uuid.UUID = uuid.UUID(request.form.get('course_uuid')) |
||||||
|
selected_course: Course = db.session.execute(select(Course).where(Course.id == course_uuid)).scalar() |
||||||
|
if not selected_course: |
||||||
|
return jsonify({'message': 'Course not found'}), 404 |
||||||
|
#make sure if user is already enrolled h/she can't enroll |
||||||
|
if db.session.execute(select(Enrollment).where(and_(Enrollment.userID == g.current_user.id, Enrollment.courseID == course_uuid))).scalar(): |
||||||
|
return jsonify({'message': 'Already enrolled to this course'}), 400 |
||||||
|
new_enroll: Enrollment = Enrollment( |
||||||
|
userID=g.current_user.id, |
||||||
|
courseID=course_uuid, |
||||||
|
user=g.current_user, |
||||||
|
course=selected_course |
||||||
|
) |
||||||
|
try: |
||||||
|
selected_course.totalEnrolled = selected_course.totalEnrolled + 1 |
||||||
|
db.session.add(new_enroll) |
||||||
|
db.session.commit() |
||||||
|
except IntegrityError: |
||||||
|
return jsonify({'message': 'Already enrolled to this course'}) |
||||||
|
return jsonify({'message': 'Enrollment successful'}), 200 |
||||||
|
|
||||||
|
@course.route('/createCourse', methods=['POST']) |
||||||
@auth_required() |
@auth_required() |
||||||
def create_course(): |
def create_course(): |
||||||
form_data: dict = request.form |
form_data: dict = request.form |
||||||
course_uploaded_cover_image: MultiDict|None = request.files.get('cover_image', None) |
course_uploaded_cover_image: MultiDict|None = request.files.get('cover_image', None) |
||||||
course_uploaded_pdf: MultiDict|None = request.files.get('course_pdf', None) |
course_uploaded_pdf: MultiDict|None = request.files.get('course_pdf', None) |
||||||
|
|
||||||
cover_file_name: str = DEFAULT_COURSE_COVER |
cover_file_name: str = DEFAULT_COURSE_COVER |
||||||
pdf_file_name: str = '' |
pdf_file_name: str = '' |
||||||
|
pdf_total_pages: int = 1 |
||||||
if course_uploaded_cover_image is not None: |
if course_uploaded_cover_image is not None: |
||||||
cover_file_name: str = random_string_generator(32)+course_uploaded_cover_image.filename.split('.')[-1] |
print("COURSE COVER ATTACHED") |
||||||
|
cover_file_name: str = random_string_generator(32)+"."+course_uploaded_cover_image.filename.split('.')[-1] |
||||||
course_uploaded_cover_image.save(os.path.join(USER_UPLOADS_DIR, cover_file_name)) |
course_uploaded_cover_image.save(os.path.join(USER_UPLOADS_DIR, cover_file_name)) |
||||||
if course_uploaded_pdf is not None: |
if course_uploaded_pdf is not None: |
||||||
pdf_file_name: str = random_string_generator(32) + course_uploaded_pdf.filename.split('.')[-1] |
print('PDF ATTACHED') |
||||||
|
pdf_file_name: str = random_string_generator(32) +"."+ course_uploaded_pdf.filename.split('.')[-1] |
||||||
course_uploaded_pdf.save(os.path.join(USER_UPLOADS_DIR, pdf_file_name)) |
course_uploaded_pdf.save(os.path.join(USER_UPLOADS_DIR, pdf_file_name)) |
||||||
published_status: PublishedStatus = PublishedStatus.DRAFT |
|
||||||
|
pdf_parts_root_dir = os.path.join(USER_UPLOADS_DIR, pdf_file_name + "_parts") |
||||||
|
os.makedirs(pdf_parts_root_dir, exist_ok=True) |
||||||
|
pdf_total_pages = split_pdf_into_pages_with_text( |
||||||
|
pdf_path=os.path.join(USER_UPLOADS_DIR, pdf_file_name), |
||||||
|
output_directory=pdf_parts_root_dir |
||||||
|
) |
||||||
|
|
||||||
|
published_status: PublishedStatus = PublishedStatus.PENDING |
||||||
try: |
try: |
||||||
course_name: str = form_data['course_name'] |
course_name: str = form_data['course_name'] |
||||||
except KeyError: |
except KeyError: |
||||||
return jsonify({'message': 'Course name cannot be empty'}), 401 |
return jsonify({'message': 'Course name cannot be empty'}), 401 |
||||||
|
|
||||||
course_description: str = form_data.get('course_description', '') |
course_description: str = form_data.get('course_description', '') |
||||||
category_id: uuid.UUID = uuid.UUID(form_data['category_uuid']) |
category_id: uuid.UUID = uuid.UUID(form_data['category_uuid']) |
||||||
pages_required_for_community: int = int(form_data['community_unlock_at_pages']) # TODO: Add this field to model |
page_for_community: int = int(form_data.get('page_for_community', 1)) # TODO: Add this field to model |
||||||
|
category: Category = db.session.execute(select(Category).where(Category.id == category_id)).scalar() |
||||||
|
# author: User = db.session.execute(select(User).where(User.id == g.current_user.id)).scalar() |
||||||
new_course: Course = Course( |
new_course: Course = Course( |
||||||
name=course_name, |
name=course_name, |
||||||
categoryID=category_id, |
categoryID=category_id, |
||||||
authorID=g.current_user.id, |
authorID=g.current_user.id, |
||||||
|
category=category, |
||||||
|
author=g.current_user, |
||||||
description=course_description, |
description=course_description, |
||||||
isActive=True, |
isActive=True, |
||||||
|
pageForCommunity=page_for_community, |
||||||
publishedStatus=int(published_status), |
publishedStatus=int(published_status), |
||||||
coverImage=cover_file_name, |
coverImage=cover_file_name, |
||||||
serverFilename=pdf_file_name, |
serverFilename=pdf_file_name, |
||||||
|
totalPages=pdf_total_pages, |
||||||
enrollments=[], |
enrollments=[], |
||||||
quizzes=[], |
quizzes=[], |
||||||
chats=[] |
chats=[] |
||||||
) |
) |
||||||
|
|
||||||
# chat: Chat = Chat(courseID=new_course.id) TODO: Add a welcome chat for this course |
# chat: Chat = Chat(courseID=new_course.id) TODO: Add a welcome chat for this course |
||||||
db.session.add_all(new_course) |
db.session.add(new_course) |
||||||
|
db.session.commit() |
||||||
|
return jsonify({'message': 'Course was created successfully.', 'courseID': new_course.id}), 200 |
||||||
|
|
||||||
|
@course.route('/update', methods=['UPDATE', 'DELETE']) |
||||||
|
@auth_required() |
||||||
|
def update_course(): |
||||||
|
form_data = request.form |
||||||
|
course_id: uuid.UUID = uuid.UUID(form_data['course_id']) |
||||||
|
selected_course: Course|None = None |
||||||
|
if g.current_user.role == int(UserRole.ADMIN): |
||||||
|
selected_course: Course = db.session.execute(select(Course).where(and_( |
||||||
|
Course.id == course_id |
||||||
|
))).scalar() |
||||||
|
else: |
||||||
|
selected_course: Course = db.session.execute(select(Course).where(and_( |
||||||
|
Course.id == course_id, Course.publishedStatus != int(PublishedStatus.BANNED) |
||||||
|
))).scalar() |
||||||
|
if not selected_course: |
||||||
|
return jsonify({'message': 'The course could not be found'}), 404 |
||||||
|
if request.method == 'DELETE': |
||||||
|
if selected_course.authorID == g.current_user.id or g.current_user.role == int(UserRole.ADMIN): |
||||||
|
db.session.delete(selected_course) |
||||||
|
db.session.commit() |
||||||
|
return jsonify({'message': 'Course was deleted successfully'}), 200 |
||||||
|
else: |
||||||
|
return jsonify({'message': 'Unauthorized for this change'}), 401 |
||||||
|
else: |
||||||
|
# Update the data |
||||||
|
if selected_course.authorID == g.current_user.id or g.current_user.role == int(UserRole.ADMIN): |
||||||
|
if form_data.get('course_name'): |
||||||
|
selected_course.name = form_data.get('course_name') |
||||||
|
if form_data.get('course_description'): |
||||||
|
selected_course.description = form_data.get('course_description') |
||||||
|
if form_data.get('category_uuid'): |
||||||
|
selected_course.categoryID = uuid.UUID(form_data.get('category_uuid')) |
||||||
|
if form_data.get('isActive'): |
||||||
|
selected_course.isActive = bool(int(form_data.get('active'))) |
||||||
|
|
||||||
|
# Admin Guarded |
||||||
|
if form_data.get('published_status'): |
||||||
|
if g.current_user.role != int(UserRole.ADMIN): |
||||||
|
return jsonify({'message': 'Unauthorized'}), 401 |
||||||
|
valid_states: list[int] = [ |
||||||
|
int(e) for e in |
||||||
|
[PublishedStatus.APPROVED, |
||||||
|
PublishedStatus.PENDING, |
||||||
|
PublishedStatus.DECLINED, |
||||||
|
PublishedStatus.REVOKED, |
||||||
|
PublishedStatus.BANNED, |
||||||
|
PublishedStatus.DRAFT] |
||||||
|
] |
||||||
|
if int(form_data.get('published_status')) not in valid_states: |
||||||
|
return jsonify({'message': 'Invalid state to update'}), 401 |
||||||
|
selected_course.publishedStatus = int(form_data.get('published_status')) |
||||||
|
if request.files.get('cover_image'): |
||||||
|
cover_file_name: str = random_string_generator(32) + request.files.get('cover_image').filename.split('.')[-1] |
||||||
|
request.files.get('cover_image').save(os.path.join(USER_UPLOADS_DIR, cover_file_name)) |
||||||
|
selected_course.coverImage = cover_file_name |
||||||
|
if request.files.get('course_pdf'): |
||||||
|
pdf_file_name: str = random_string_generator(32) + request.files.get('course_pdf').filename.split('.')[1] |
||||||
|
request.files.get('course_pdf').save(os.path.join(USER_UPLOADS_DIR, pdf_file_name)) |
||||||
|
selected_course.serverFilename = pdf_file_name |
||||||
|
if g.current_user.role != int(UserRole.ADMIN): |
||||||
|
selected_course.publishedStatus = int(PublishedStatus.PENDING) |
||||||
|
db.session.commit() |
||||||
|
return jsonify({'message': 'Course info updated'}), 200 |
||||||
|
else: |
||||||
|
return jsonify({'message': 'Unauthorized for this change'}), 401 |
||||||
|
|
||||||
|
@course.route('/info/<string:course_uuid>') |
||||||
|
def course_info(course_uuid): |
||||||
|
course_uuid: uuid.UUID = uuid.UUID(course_uuid) |
||||||
|
selected_course: Course = db.session.execute(select(Course).where(and_(Course.id == course_uuid))).scalar() |
||||||
|
if not selected_course: |
||||||
|
return jsonify({'message': 'The course does not exist'}), 404 |
||||||
|
# Only allow owner or admin to query info for course that is not published or is pending |
||||||
|
if not selected_course.isActive or selected_course.publishedStatus != int(PublishedStatus.APPROVED): |
||||||
|
if g.get("is_authed"): |
||||||
|
if g.current_user.role == int(UserRole.ADMIN) or g.current_user.id == selected_course.authorID: |
||||||
|
pass |
||||||
|
else: |
||||||
|
return jsonify({'message': 'The course does not exist.'}), 404 |
||||||
|
self_enrollment_record: Union[None, Enrollment] = None |
||||||
|
self_enrollment_data: dict = {} |
||||||
|
if g.get("is_authed"): |
||||||
|
self_enrollment_record: Enrollment = db.session.execute( |
||||||
|
select(Enrollment).where( |
||||||
|
and_( |
||||||
|
Enrollment.courseID == selected_course.id, Enrollment.userID == g.current_user.id |
||||||
|
) |
||||||
|
) |
||||||
|
) |
||||||
|
if self_enrollment_record: |
||||||
|
self_enrollment_data = { |
||||||
|
'lastActivity': self_enrollment_record.lastActivity, |
||||||
|
'currentPage': self_enrollment_record.currentPage, |
||||||
|
'maxPage': self_enrollment_record.maxPage, |
||||||
|
'joinedDate': self_enrollment_record.joinedDate, |
||||||
|
'userID': self_enrollment_record.userID |
||||||
|
} |
||||||
|
# Get total enrolled user and total unique user chatting about the course and put it in dict |
||||||
|
summary_user: dict = { |
||||||
|
'totalEnrolled': db.session.execute( |
||||||
|
select(func.count(Enrollment.id)).where(Enrollment.courseID == course_uuid) |
||||||
|
).scalar(), |
||||||
|
|
||||||
|
'usersInChat': db.session.execute( |
||||||
|
select(func.count(distinct(Chat.userID))).select_from(Chat).where(Chat.courseID == course_uuid) |
||||||
|
).scalar(), |
||||||
|
|
||||||
|
'totalChats': db.session.execute( |
||||||
|
select(func.count()).select_from(Chat).where(Chat.courseID == course_uuid) |
||||||
|
).scalar() |
||||||
|
} |
||||||
|
pages: list = [] |
||||||
|
if self_enrollment_record: |
||||||
|
for i in range(selected_course.totalPages): |
||||||
|
pages.append( |
||||||
|
url_for('get_pdf_file_as_pages', |
||||||
|
filename=selected_course.serverFilename, |
||||||
|
page=i + 1, |
||||||
|
dtype='pdf') |
||||||
|
) |
||||||
|
else: |
||||||
|
if selected_course.totalPages < 3: |
||||||
|
pages.append( |
||||||
|
url_for('get_pdf_file_as_pages', |
||||||
|
filename=selected_course.serverFilename, |
||||||
|
page=1, |
||||||
|
dtype='pdf') |
||||||
|
) |
||||||
|
else: |
||||||
|
for i in range(3): |
||||||
|
pages.append( |
||||||
|
url_for('get_pdf_file_as_pages', |
||||||
|
filename=selected_course.serverFilename, |
||||||
|
page=i+1, |
||||||
|
dtype='pdf') |
||||||
|
) |
||||||
|
return jsonify({ |
||||||
|
'message': 'successful', |
||||||
|
'data': { |
||||||
|
'id': selected_course.id, |
||||||
|
'courseName': selected_course.name, |
||||||
|
'courseDescription': selected_course.description, |
||||||
|
'isActive': selected_course.isActive, |
||||||
|
'publishedStatus': selected_course.publishedStatus, |
||||||
|
'creationDate': selected_course.creationDate, # TODO: Format to particular structure |
||||||
|
'coverImage': url_for('send_file', filename=selected_course.coverImage), |
||||||
|
'serverFilename': url_for('send_file', filename=selected_course.serverFilename), |
||||||
|
'totalPages': 100, |
||||||
|
'pages': pages, |
||||||
|
'author': { |
||||||
|
'id': selected_course.authorID, |
||||||
|
'username': selected_course.author.username, |
||||||
|
'firstName': selected_course.author.firstName, |
||||||
|
'lastName': selected_course.author.lastName, |
||||||
|
'pfpFilename': url_for('send_file', filename=selected_course.author.pfpFilename), |
||||||
|
'bio': selected_course.author.bio |
||||||
|
}, |
||||||
|
'selfEnrollment': { |
||||||
|
'isEnrolled': self_enrollment_record is not None, |
||||||
|
'data': self_enrollment_data |
||||||
|
}, |
||||||
|
'enrollmentSummary': summary_user |
||||||
|
} |
||||||
|
}), 200 |
||||||
|
|
||||||
|
@course.route('/getCategories', methods=['GET']) |
||||||
|
def get_categories(): |
||||||
|
categories: list[Category] = db.session.execute(select(Category)).scalars() |
||||||
|
cat_list: list[dict] = [] |
||||||
|
for category in categories: |
||||||
|
cat_list.append( |
||||||
|
{ |
||||||
|
'id': category.id, |
||||||
|
'name': category.name, |
||||||
|
'description': category.description, |
||||||
|
'isActive': category.isActive, |
||||||
|
'creationDate': category.creationDate |
||||||
|
} |
||||||
|
) |
||||||
|
return jsonify(cat_list), 200 |
||||||
|
|
||||||
|
@course.route('/createCategory', methods=['Post']) |
||||||
|
@auth_required() |
||||||
|
@requires_role([UserRole.ADMIN]) |
||||||
|
def create_category(): |
||||||
|
try: |
||||||
|
new_cat: Category = Category( |
||||||
|
name=request.form['name'], |
||||||
|
description=request.form.get('description'), |
||||||
|
isActive=bool(int(request.form.get('isActive'))), |
||||||
|
courses=[] |
||||||
|
) |
||||||
|
except KeyError: |
||||||
|
return jsonify({'message': 'Missing required parameter "name" '}), 400 |
||||||
|
db.session.add(new_cat) |
||||||
|
db.session.commit() |
||||||
|
return jsonify({'message': 'Category created'}), 201 |
||||||
|
|
||||||
|
@course.route('/updateCategory', methods=['POST', 'DELETE']) |
||||||
|
@auth_required() |
||||||
|
@requires_role([UserRole.ADMIN]) |
||||||
|
def update_category(): |
||||||
|
form_data: dict = request.form |
||||||
|
try: |
||||||
|
category_id: uuid.UUID = uuid.UUID(form_data['category_id']) |
||||||
|
except KeyError: |
||||||
|
return jsonify({'message': 'Missing required parameter "category_id" '}), 400 |
||||||
|
selected_category: Category = db.session.execute(select(Category).where(Category.id == category_id)).scalar() |
||||||
|
if not selected_category: |
||||||
|
return jsonify({'message': 'Category not found'}), 404 |
||||||
|
if request.method == 'DELETE': |
||||||
|
db.session.delete(selected_category) |
||||||
|
db.session.commit() |
||||||
|
return jsonify({'message': 'Category deleted'}), 200 |
||||||
|
else: |
||||||
|
if form_data.get('name'): |
||||||
|
selected_category.name = form_data.get('name') |
||||||
|
if form_data.get('description'): |
||||||
|
selected_category.description = form_data.get('description') |
||||||
|
if form_data.get('isActive'): |
||||||
|
selected_category.isActive = bool(int(form_data.get('isActive'))) |
||||||
|
db.session.commit() |
||||||
|
return jsonify({'message': 'Category updated'}), 200 |
||||||
|
|
||||||
|
@course.route('/enrolled') |
||||||
|
@auth_required() |
||||||
|
def enrolled_courses(): |
||||||
|
enrollments: Course = db.session.execute( |
||||||
|
select(Enrollment).where( |
||||||
|
and_(Enrollment.userID == g.current_user.id, Course.publishedStatus == int(PublishedStatus.APPROVED)) |
||||||
|
) |
||||||
|
).scalars() |
||||||
|
enrolled_list: list[dict] = [] |
||||||
|
for enroll_row in enrollments: |
||||||
|
item = enroll_row.course |
||||||
|
enrolled_list.append( |
||||||
|
{ |
||||||
|
'id': enroll_row.id, |
||||||
|
'course_id': enroll_row.courseID, |
||||||
|
'lastActivity': enroll_row.lastActivity, |
||||||
|
'currentPage': enroll_row.currentPage, |
||||||
|
'maxPage': enroll_row.maxPage, |
||||||
|
'joinedDate': enroll_row.joinedDate, |
||||||
|
'userID': enroll_row.userID, |
||||||
|
'name': item.name, |
||||||
|
'description': item.description, |
||||||
|
'isActive': item.isActive, |
||||||
|
'creationDate': item.creationDate, |
||||||
|
'coverImage': url_for('send_file', filename=item.coverImage), |
||||||
|
'totalEnrolled': item.totalEnrolled, |
||||||
|
'author': { |
||||||
|
'id': item.author.id, |
||||||
|
'firstName': item.author.firstName, |
||||||
|
'lastName': item.author.lastName, |
||||||
|
'username': item.author.username, |
||||||
|
'bio': item.author.bio, |
||||||
|
'lastOnline': item.author.lastOnline, |
||||||
|
'pfpFilename': url_for('send_file', filename=item.author.pfpFilename) |
||||||
|
}, |
||||||
|
'category': { |
||||||
|
'id': item.categoryID, |
||||||
|
'name': item.category.name, |
||||||
|
'description': item.category.description |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
return jsonify(enrolled_list), 200 |
||||||
|
|
||||||
|
@course.route('/myCourses') |
||||||
|
@auth_required() |
||||||
|
def my_courses(): |
||||||
|
courses: Course = db.session.execute(select(Course).where(Course.authorID == g.current_user.id) |
||||||
|
).scalars() |
||||||
|
course_list: list[dict] = [] |
||||||
|
for item in courses: |
||||||
|
course_list.append( |
||||||
|
{ |
||||||
|
'id': item.id, |
||||||
|
'name': item.name, |
||||||
|
'description': item.description, |
||||||
|
'isActive': item.isActive, |
||||||
|
'publishedStatus': item.publishedStatus, |
||||||
|
'creationDate': item.creationDate, |
||||||
|
'coverImage': url_for('send_file', filename=item.coverImage), |
||||||
|
'totalEnrolled': item.totalEnrolled, |
||||||
|
'author': { |
||||||
|
'id': item.author.id, |
||||||
|
'firstName': item.author.firstName, |
||||||
|
'lastName': item.author.lastName, |
||||||
|
'username': item.author.username, |
||||||
|
'bio': item.author.bio, |
||||||
|
'lastOnline': item.author.lastOnline, |
||||||
|
'pfpFilename': url_for('send_file', filename=item.author.pfpFilename) |
||||||
|
}, |
||||||
|
'category': { |
||||||
|
'id': item.categoryID, |
||||||
|
'name': item.category.name, |
||||||
|
'description': item.category.description |
||||||
|
} |
||||||
|
}) |
||||||
|
return jsonify(course_list), 200 |
||||||
|
|
||||||
|
@course.route('/seed', methods=['POST']) |
||||||
|
def seed_categories(): |
||||||
|
"""Seed the database with 10 predefined categories.""" |
||||||
|
categories = [ |
||||||
|
{"name": "Programming", "description": "Learn coding and software development.", "isActive": True}, |
||||||
|
{"name": "History", "description": "Explore historical events and figures.", "isActive": True}, |
||||||
|
{"name": "Mathematics", "description": "Understand mathematical concepts and theories.", "isActive": True}, |
||||||
|
{"name": "Science", "description": "Dive into the world of science and discovery.", "isActive": True}, |
||||||
|
{"name": "Art", "description": "Appreciate and create beautiful works of art.", "isActive": True}, |
||||||
|
{"name": "Music", "description": "Discover music theory and practice.", "isActive": True}, |
||||||
|
{"name": "Sports", "description": "Learn about various sports and fitness activities.", "isActive": True}, |
||||||
|
{"name": "Health", "description": "Focus on wellness and healthy living.", "isActive": True}, |
||||||
|
{"name": "Technology", "description": "Stay updated with the latest tech trends.", "isActive": True}, |
||||||
|
{"name": "Business", "description": "Understand business strategies and management.", "isActive": True}, |
||||||
|
] |
||||||
|
|
||||||
|
# Insert categories into the database |
||||||
|
try: |
||||||
|
for category in categories: |
||||||
|
new_category = Category( |
||||||
|
name=category['name'], |
||||||
|
description=category['description'], |
||||||
|
isActive=category['isActive'], |
||||||
|
courses=[] |
||||||
|
) |
||||||
|
db.session.add(new_category) |
||||||
|
db.session.commit() |
||||||
|
return jsonify({"message": "Categories seeded successfully."}), 201 |
||||||
|
except IntegrityError: |
||||||
|
db.session.rollback() |
||||||
|
return jsonify({"message": "Some categories already exist."}), 400 |
||||||
|
except Exception as e: |
||||||
|
return jsonify({"message": f"An error occurred: {str(e)}"}), 500 |
||||||
|
|
||||||
|
|
||||||
|
@course.route('/seed_courses', methods=['POST']) |
||||||
|
def seed_courses(): |
||||||
|
"""Seed the database with courses for existing categories.""" |
||||||
|
try: |
||||||
|
# Fetch all categories from the database |
||||||
|
categories = Category.query.all() |
||||||
|
if not categories: |
||||||
|
return jsonify({"message": "No categories found. Please seed categories first."}), 400 |
||||||
|
|
||||||
|
# Predefined courses with associated category names |
||||||
|
courses = [ |
||||||
|
{"name": "Python Programming", "category": "Programming", "description": "Learn Python from scratch."}, |
||||||
|
{"name": "World History", "category": "History", "description": "Explore key historical events."}, |
||||||
|
{"name": "Algebra Basics", "category": "Mathematics", "description": "Understand fundamental algebra concepts."}, |
||||||
|
{"name": "Physics 101", "category": "Science", "description": "Dive into the principles of physics."}, |
||||||
|
{"name": "Digital Painting", "category": "Art", "description": "Learn the basics of digital art."}, |
||||||
|
{"name": "Guitar for Beginners", "category": "Music", "description": "Master the basics of playing guitar."}, |
||||||
|
{"name": "Fitness Fundamentals", "category": "Sports", "description": "Achieve your fitness goals."}, |
||||||
|
{"name": "Healthy Living", "category": "Health", "description": "Tips for a healthier lifestyle."}, |
||||||
|
{"name": "AI Basics", "category": "Technology", "description": "Introduction to Artificial Intelligence."}, |
||||||
|
{"name": "Business Strategies", "category": "Business", "description": "Learn how to develop business strategies."}, |
||||||
|
] |
||||||
|
|
||||||
|
# Create and add courses to the database |
||||||
|
for course_data in courses: |
||||||
|
# Find the category by name |
||||||
|
category = next((cat for cat in categories if cat.name == course_data["category"]), None) |
||||||
|
if not category: |
||||||
|
continue # Skip if the category doesn't exist |
||||||
|
|
||||||
|
# Create a new course |
||||||
|
new_course = Course( |
||||||
|
name=course_data["name"], |
||||||
|
categoryID=category.id, |
||||||
|
description=course_data["description"], |
||||||
|
authorID=None, # Set an appropriate author ID here |
||||||
|
totalPages=10, # Example value |
||||||
|
totalEnrolled=0, |
||||||
|
isActive=True, |
||||||
|
publishedStatus=1, |
||||||
|
enrollments=[], |
||||||
|
quizzes=[], |
||||||
|
chats=[] |
||||||
|
) |
||||||
|
db.session.add(new_course) |
||||||
|
|
||||||
db.session.commit() |
db.session.commit() |
||||||
return jsonify({'message': 'Course was created successfully.'}), 200 |
return jsonify({"message": "Courses seeded successfully."}), 201 |
||||||
|
except Exception as e: |
||||||
|
db.session.rollback() |
||||||
|
return jsonify({"message": f"An error occurred: {str(e)}"}), 500 |
||||||
|
@ -1,108 +1,3 @@ |
|||||||
from flask import Blueprint, jsonify, request, g |
from flask import Blueprint |
||||||
from utils.auth import auth_required |
|
||||||
from db.model import User, Notification, db |
|
||||||
from sqlalchemy import select, and_, desc |
|
||||||
from datetime import datetime |
|
||||||
import uuid |
|
||||||
|
|
||||||
notification = Blueprint('notification', __name__) |
notification = Blueprint('notification', __name__) |
||||||
|
|
||||||
@notification.route('/get', methods=['GET', 'POST']) |
|
||||||
@auth_required() |
|
||||||
def handle_notifications(): |
|
||||||
""" |
|
||||||
Unified endpoint for handling notifications: |
|
||||||
GET: Fetch notifications with optional before/after pagination |
|
||||||
POST: Mark notifications as seen |
|
||||||
|
|
||||||
Query Parameters for GET: |
|
||||||
- before: UUID of notification to get older entries |
|
||||||
- after: UUID of notification to get newer entries |
|
||||||
- limit: Number of notifications to return (default: 10) |
|
||||||
|
|
||||||
POST Body: |
|
||||||
{ |
|
||||||
"notificationIds": ["uuid1", "uuid2", ...] |
|
||||||
} |
|
||||||
""" |
|
||||||
if request.method == 'GET': |
|
||||||
try: |
|
||||||
current_user: User = g.current_user |
|
||||||
limit: int = int(request.args.get('limit', 10)) |
|
||||||
before_id = request.args.get('before') |
|
||||||
after_id = request.args.get('after') |
|
||||||
|
|
||||||
# Base query |
|
||||||
query = select(Notification).where( |
|
||||||
Notification.userID == current_user.id |
|
||||||
) |
|
||||||
|
|
||||||
# Handle pagination |
|
||||||
if before_id: |
|
||||||
try: |
|
||||||
reference_notification = db.session.execute( |
|
||||||
select(Notification) |
|
||||||
.where(and_( |
|
||||||
Notification.id == uuid.UUID(before_id), |
|
||||||
Notification.userID == current_user.id |
|
||||||
)) |
|
||||||
).scalar() |
|
||||||
|
|
||||||
if not reference_notification: |
|
||||||
return jsonify({'message': 'Reference notification not found'}), 404 |
|
||||||
|
|
||||||
query = query.where( |
|
||||||
Notification.notifDate < reference_notification.notifDate |
|
||||||
) |
|
||||||
except ValueError: |
|
||||||
return jsonify({'message': 'Invalid notification ID format'}), 400 |
|
||||||
|
|
||||||
elif after_id: |
|
||||||
try: |
|
||||||
reference_notification = db.session.execute( |
|
||||||
select(Notification) |
|
||||||
.where(and_( |
|
||||||
Notification.id == uuid.UUID(after_id), |
|
||||||
Notification.userID == current_user.id |
|
||||||
)) |
|
||||||
).scalar() |
|
||||||
|
|
||||||
if not reference_notification: |
|
||||||
return jsonify({'message': 'Reference notification not found'}), 404 |
|
||||||
|
|
||||||
query = query.where( |
|
||||||
Notification.notifDate > reference_notification.notifDate |
|
||||||
) |
|
||||||
# For after queries, we need to reverse the order later |
|
||||||
query = query.order_by(Notification.notifDate) |
|
||||||
except ValueError: |
|
||||||
return jsonify({'message': 'Invalid notification ID format'}), 400 |
|
||||||
else: |
|
||||||
# Default ordering |
|
||||||
query = query.order_by(desc(Notification.notifDate)) |
|
||||||
|
|
||||||
# Apply limit and execute query |
|
||||||
query = query.limit(limit) |
|
||||||
notifications = list(db.session.execute(query).scalars()) |
|
||||||
|
|
||||||
# Reverse the order for 'after' queries to maintain consistency |
|
||||||
if after_id: |
|
||||||
notifications.reverse() |
|
||||||
|
|
||||||
# Format response |
|
||||||
notif_list = [{ |
|
||||||
'id': str(notif.id), |
|
||||||
'type': notif.notificationType, |
|
||||||
'data': notif.notificationData, |
|
||||||
'seen': notif.isSeen, |
|
||||||
'date': notif.notifDate.isoformat() |
|
||||||
} for notif in notifications] |
|
||||||
|
|
||||||
return jsonify({ |
|
||||||
'notifications': notif_list, |
|
||||||
'count': len(notif_list), |
|
||||||
'hasMore': len(notif_list) == limit |
|
||||||
}), 200 |
|
||||||
|
|
||||||
except Exception as e: |
|
||||||
return jsonify({'message': f'An error occurred: {str(e)}'}), 500 |
|
@ -1,52 +1,228 @@ |
|||||||
from flask import Blueprint |
import json |
||||||
from flask import Blueprint, request, jsonify, current_app, g |
import os |
||||||
from db.model import User, Category, Quiz, Course, Enrollment, QuizAttempt |
|
||||||
from db.model import db |
|
||||||
import uuid |
import uuid |
||||||
from sqlalchemy import select, and_ |
import requests |
||||||
|
from flask import Blueprint, request, jsonify, g, url_for |
||||||
|
from uuid import UUID |
||||||
|
from db.model import db, User, Course, Enrollment,Chat, Quiz, QuizAttempt |
||||||
|
from utils.auth import auth_required |
||||||
|
import requests |
||||||
|
from config import SPAM_SCORE_THRESHOLD, AI_SPAM_SERVICES_MICROSERVICE, USER_UPLOADS_DIR, AI_QUIZ_SERVICES_MICROSERVICE |
||||||
|
from sqlalchemy import desc, select, and_ |
||||||
|
|
||||||
quiz = Blueprint('quiz', __name__) |
quiz = Blueprint('quiz', __name__) |
||||||
|
|
||||||
|
|
||||||
@quiz.route('/create', methods=['POST']) |
@quiz.route('/generate', methods=['POST']) |
||||||
def create_quiz(): |
@auth_required() |
||||||
data: dict = request.form |
def generate_quiz(): |
||||||
creator_user: User = g.current_user |
try: |
||||||
course_id: uuid.UUID = uuid.UUID(data.get('courseID')) |
course_id: uuid.UUID = uuid.UUID(request.form['course_id']) |
||||||
enrollment_data: Enrollment = db.session.execute(select(Enrollment).where(and_(Enrollment.courseID == course_id, Enrollment.userID == creator_user.id))).scalar() |
current_page: int = int(request.form['page']) |
||||||
if not enrollment_data: |
except KeyError: |
||||||
return jsonify({'message': 'You are not enrolled in this class'}), 401 |
return jsonify({'message': 'course_id and page must be specified'}), 401 |
||||||
|
enrollment_record: Enrollment = db.session.execute( |
||||||
get_quiz_data :str = '{"questions":[{"question":"What is the capital of France?","options":["Paris","London","Berlin","Madrid"],"answer":"Paris"},{"question":"What is 2 + 2?","options":["3","4","5","6"],"answer":"4"}]}' |
select(Enrollment).where(and_( |
||||||
new_quiz = Quiz( |
Enrollment.courseID == course_id, |
||||||
creatorUserID = creator_user.id, |
Enrollment.userID == g.current_user.id) |
||||||
|
) |
||||||
|
).scalar() |
||||||
|
if not enrollment_record: |
||||||
|
return jsonify({"error": "You are not enrolled in this course."}), 403 |
||||||
|
if current_page > enrollment_record.course.totalPages or current_page < 1: |
||||||
|
return jsonify({ |
||||||
|
'message': 'Page range out of bound. No such page' |
||||||
|
}), 404 |
||||||
|
# Everything is alright, now get the text in current page and generate quiz |
||||||
|
current_page_text: str = '' |
||||||
|
with open( |
||||||
|
os.path.join( |
||||||
|
USER_UPLOADS_DIR, |
||||||
|
enrollment_record.course.serverFilename+"_parts", |
||||||
|
f"{current_page}.txt") |
||||||
|
) as f: |
||||||
|
current_page_text = f.read() |
||||||
|
quiz_data_resp = requests.post(AI_QUIZ_SERVICES_MICROSERVICE, json={"string_message": current_page_text}) |
||||||
|
if quiz_data_resp.status_code != 200: |
||||||
|
return jsonify({"error": "Failed to make quiz request."}), 500 |
||||||
|
quiz_data = quiz_data_resp.json() |
||||||
|
# Insert the quiz into table |
||||||
|
rows: list[Quiz] = [] |
||||||
|
for quiz_item in quiz_data['questions']: |
||||||
|
rows.append( |
||||||
|
Quiz( |
||||||
|
creatorUserID=g.current_user.id, |
||||||
|
creatorUser=g.current_user, |
||||||
|
quiz_attempts=[], |
||||||
courseID=course_id, |
courseID=course_id, |
||||||
quizJson = get_quiz_data, |
course=enrollment_record.course, |
||||||
quiz_attempts = [] |
quizQuestion=quiz_item['question'], |
||||||
|
quizAnswers=json.dumps(quiz_item['options']), |
||||||
|
quizCorrectAnswer=quiz_item['correct_answer'] |
||||||
) |
) |
||||||
db.session.add_all(new_quiz) |
) |
||||||
|
db.session.add_all(rows) |
||||||
db.session.commit() |
db.session.commit() |
||||||
return jsonify({'message': 'Course was created successfully.'}), 200 |
return jsonify({'message': 'quizzes were generated for the current page'}) |
||||||
|
|
||||||
@quiz.route('/attempt', methods=['POST']) |
@quiz.route('/get/personalIncomplete') |
||||||
def attempt_quiz(): |
@auth_required() |
||||||
data: dict = request.form |
def get_incomplete_quiz(): |
||||||
attempt_user: User = g.current_user |
try: |
||||||
quiz_id: uuid.UUID = uuid.UUID(data.get('quizID')) |
course_id: uuid.UUID = uuid.UUID(request.form['course_id']) |
||||||
course_data: Enrollment = db.session.execute(select(Enrollment).where(and_(Enrollment.courseID == course_data, Enrollment.userID == attempt_user.id))).scalar() |
except KeyError: |
||||||
if not course_data: |
return jsonify({'message': 'course_id must be specified'}), 401 |
||||||
return jsonify({'message': 'You are not enrolled in this class'}), 401 |
quiz_rows: list[Quiz] = db.session.execute(select(Quiz).where( |
||||||
|
and_(Quiz.creatorUserID == g.current_user.id, Quiz.creatorHasAttempted == False) |
||||||
answerKey: str = '{"questions":[{"question":"What is the capital of France?","options":["Paris","London","Berlin","Madrid"],"answer":"Paris"},{"question":"What is 2 + 2?","options":["3","4","5","6"],"answer":"4"}]}' |
)).scalars() |
||||||
#function to calculate Score |
data: list = [] |
||||||
score_value = 0 |
for quiz_row in quiz_rows: |
||||||
|
data.append( |
||||||
new_attempt = QuizAttempt( |
{ |
||||||
userID = attempt_user, |
'id': quiz_row.id, |
||||||
|
'isActive': quiz_row.isActive, |
||||||
|
'creationDate': quiz_row.creationDate, |
||||||
|
'quizAnswers': quiz_row.quizAnswers, |
||||||
|
'quizQuestion': quiz_row.quizQuestion, |
||||||
|
'course': { |
||||||
|
'id': quiz_row.course.id, |
||||||
|
'name': quiz_row.course.name, |
||||||
|
'description': quiz_row.course.description |
||||||
|
}, |
||||||
|
'creator': { |
||||||
|
'id': quiz_row.creatorUserID, |
||||||
|
'firstName': quiz_row.creatorUser.firstName, |
||||||
|
'lastName': quiz_row.creatorUser.lastName, |
||||||
|
'username': quiz_row.creatorUser.username, |
||||||
|
'pfpFilename': url_for('send_file', filename=quiz_row.creatorUser.pfpFilename) |
||||||
|
} |
||||||
|
} |
||||||
|
) |
||||||
|
return jsonify({ |
||||||
|
'count': len(data), |
||||||
|
'data': data |
||||||
|
}), 200 |
||||||
|
|
||||||
|
|
||||||
|
@quiz.route('/get/allComplete') |
||||||
|
@auth_required() |
||||||
|
def get_complete_quiz(): |
||||||
|
try: |
||||||
|
course_id: uuid.UUID = uuid.UUID(request.form['course_id']) |
||||||
|
except KeyError: |
||||||
|
return jsonify({'message': 'course_id must be specified'}), 401 |
||||||
|
quiz_attempts: list[QuizAttempt] = db.session.execute( |
||||||
|
select(QuizAttempt).where(and_( |
||||||
|
QuizAttempt.userID == g.current_user.id, |
||||||
|
Course.id == course_id |
||||||
|
))).scalars() # IF THIS DOES NOT WORK, ADD COURSE IF TO QUIZ_ATTEMPT TABLE ITSELF |
||||||
|
completes: list = [] |
||||||
|
for attempt in quiz_attempts: |
||||||
|
quiz_row: Quiz = attempt.quiz |
||||||
|
completes.append( |
||||||
|
{ |
||||||
|
'id': attempt.id, |
||||||
|
'quizID': quiz_row.id, |
||||||
|
'isActive': quiz_row.isActive, |
||||||
|
'creationDate': quiz_row.creationDate, |
||||||
|
'quizAnswers': quiz_row.quizAnswers, |
||||||
|
'quizQuestion': quiz_row.quizQuestion, |
||||||
|
'userAnswer': attempt.userAnswer, |
||||||
|
'quizCorrectAnswer': quiz_row.quizCorrectAnswer, |
||||||
|
'isCorrect': attempt.isCorrect, |
||||||
|
'course': { |
||||||
|
'id': quiz_row.course.id, |
||||||
|
'name': quiz_row.course.name, |
||||||
|
'description': quiz_row.course.description |
||||||
|
}, |
||||||
|
'creator': { |
||||||
|
'id': quiz_row.creatorUserID, |
||||||
|
'firstName': quiz_row.creatorUser.firstName, |
||||||
|
'lastName': quiz_row.creatorUser.lastName, |
||||||
|
'username': quiz_row.creatorUser.username, |
||||||
|
'pfpFilename': url_for('send_file', filename=quiz_row.creatorUser.pfpFilename) |
||||||
|
} |
||||||
|
} |
||||||
|
) |
||||||
|
return jsonify({ |
||||||
|
'count': len(completes), |
||||||
|
'data': completes |
||||||
|
}), 200 |
||||||
|
|
||||||
|
|
||||||
|
@quiz.route('/submit',methods=['POST']) |
||||||
|
@auth_required() |
||||||
|
def submit_quiz(): |
||||||
|
try: |
||||||
|
answer: str = request.form['answer'].strip() |
||||||
|
quiz_id: uuid.UUID = uuid.UUID(request.form['quiz_id']) |
||||||
|
except KeyError: |
||||||
|
return jsonify({'message': 'course_id and answer must be specified'}), 401 |
||||||
|
quiz_already_attempted: QuizAttempt = db.session.execute(select(QuizAttempt).where( |
||||||
|
and_(QuizAttempt.quizID == quiz_id, QuizAttempt.userID == g.current_user.id ) |
||||||
|
)).scalar() |
||||||
|
if quiz_already_attempted: |
||||||
|
return jsonify({'message': 'Already attempted this quiz'}), 401 |
||||||
|
quiz_row: Quiz = db.session.execute(select(Quiz).where(Quiz.id == quiz_id)).scalar() |
||||||
|
if not quiz_row: |
||||||
|
return jsonify({'message': 'Quiz does not exist'}), 404 |
||||||
|
valid_answers: list = json.loads(quiz_row.quizAnswers) |
||||||
|
is_correct: bool = False |
||||||
|
if answer not in valid_answers: |
||||||
|
return jsonify({'message': 'No such choice of answer given'}), 404 |
||||||
|
if answer == quiz_row.quizCorrectAnswer: |
||||||
|
is_correct = True |
||||||
|
new_attempt: QuizAttempt = QuizAttempt( |
||||||
|
userID=g.current_user.id, |
||||||
|
user=g.current_user, |
||||||
quizID=quiz_id, |
quizID=quiz_id, |
||||||
answerKey = answerKey, |
quiz=quiz_row, |
||||||
score = score_value |
userAnswer=answer, |
||||||
|
isCorrect=int(is_correct) |
||||||
) |
) |
||||||
db.session.add_all(new_attempt) |
db.session.add(new_attempt) |
||||||
|
|
||||||
|
if quiz_row.creatorUser.id == g.current_user.id: |
||||||
|
quiz_row.creatorHasAttempted = True |
||||||
|
|
||||||
db.session.commit() |
db.session.commit() |
||||||
return jsonify({'message': 'Quiz was appended sucessfully'}), 200 |
return jsonify({ |
||||||
|
'message': 'Answer submitted', |
||||||
|
'isCorrect': is_correct, |
||||||
|
'attemptID': new_attempt.id, |
||||||
|
'quizID': quiz_row.id, |
||||||
|
'quizAnswers': quiz_row.quizAnswers, |
||||||
|
'quizQuestion': quiz_row.quizQuestion, |
||||||
|
'quizCorrectAnswer': quiz_row.quizCorrectAnswer, |
||||||
|
'userAnswer': answer |
||||||
|
}) |
||||||
|
|
||||||
|
@quiz.route('/quizData') |
||||||
|
@auth_required() |
||||||
|
def get_quiz_info(): |
||||||
|
try: |
||||||
|
quiz_id: uuid.UUID = uuid.UUID(request.args['quiz_id']) |
||||||
|
except KeyError: |
||||||
|
return jsonify({'message': 'quiz_id must be specified'}), 401 |
||||||
|
quiz_row: Quiz = db.session.execute(select(Quiz).where(Quiz.id == quiz_id)).scalar() |
||||||
|
if not quiz_row: |
||||||
|
return jsonify({'message': 'Quiz does not exist'}), 404 |
||||||
|
return jsonify({ |
||||||
|
'id': quiz_row.id, |
||||||
|
'isActive': quiz_row.isActive, |
||||||
|
'creationDate': quiz_row.creationDate, |
||||||
|
'quizAnswers': quiz_row.quizAnswers, |
||||||
|
'quizQuestion': quiz_row.quizQuestion, |
||||||
|
'course': { |
||||||
|
'id': quiz_row.course.id, |
||||||
|
'name': quiz_row.course.name, |
||||||
|
'description': quiz_row.course.description |
||||||
|
}, |
||||||
|
'creator': { |
||||||
|
'id': quiz_row.creatorUserID, |
||||||
|
'firstName': quiz_row.creatorUser.firstName, |
||||||
|
'lastName': quiz_row.creatorUser.lastName, |
||||||
|
'username': quiz_row.creatorUser.username, |
||||||
|
'pfpFilename': url_for('send_file', filename=quiz_row.creatorUser.pfpFilename) |
||||||
|
} |
||||||
|
}), 200 |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
Discrete Mathematics ICT101 Assessment 3 ( 50%) |
||||||
|
Instructions |
||||||
|
Assessment Type : Individual Assignment |
||||||
|
Purpose of the assessment : To develop a plan for a real -world example of an |
||||||
|
application in information technology from the one of the topics given below . |
||||||
|
This assessment contributes to the various learning outcomes of your Bachelor |
||||||
|
of IT degree. |
||||||
|
|
||||||
|
Assessment Task : In the initial part of assignment, the student will be tested on their skills on |
||||||
|
writing literature review of a topic student have learnt in the Discrete Mathematics (ICT101) course |
||||||
|
in the week 1 to 6. Students need to read at least 3 articles or bo oks on this topic especially with |
||||||
|
application to Information Technology and give detail review of those. Student will also identify one |
||||||
|
application of information Technology related to the topic in which he/she is interested and write a |
||||||
|
complete account of that interest. |
||||||
|
|
||||||
|
Student can use the following database to find article or books. |
||||||
|
o EBSCO Databases |
||||||
|
o Emerald Insight |
||||||
|
o IBISWorld |
||||||
|
o IGI Global |
||||||
|
o ProQuest eBooks |
||||||
|
o O’Reilly Learnin g |
||||||
|
|
||||||
|
Student will be exploring and analysis the application of information technology related to the topic |
||||||
|
which are identified by him/her , and he/she must recognise an application that can be programmed |
||||||
|
into computer. Each group must sketch a plane to draw a flow -chart and algorithm. Use some inputs |
||||||
|
to test the algorithm (Give different trace table for each input) and identify any problem in the |
||||||
|
algorithm. Suggest a plane to rectify or explain why it can ’t be rectified. Each student must write on e |
||||||
|
report on its findings. |
||||||
|
|
@ -0,0 +1,45 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Student can choose one from the following Topic. However, after deciding on the topic to work on , |
||||||
|
consult with your tutor. |
||||||
|
The topic student group can choose from are : |
||||||
|
• Number system used in Computing |
||||||
|
• Logic in computing |
||||||
|
• Inverse Function in Computing |
||||||
|
• Induction Proof and its computing applicatio n |
||||||
|
• 16-bit representation |
||||||
|
• Cryptography |
||||||
|
|
||||||
|
The written report must have the following sections: |
||||||
|
1. Introduction |
||||||
|
2. Proper reference of at least three articles or books |
||||||
|
3. Write detail review of those articles or books related to the topic student chooses |
||||||
|
|
||||||
|
4. Identify one application in Information Technology in which student is interested. |
||||||
|
Write a complete account of that interest |
||||||
|
5. Description of why students choose this application |
||||||
|
6. Give a complete plane to implement the application into a computer program with use of |
||||||
|
flow -chart |
||||||
|
7. Write an appropriate algorithm |
||||||
|
8. Use at least two inputs to test the algor ithm. Group need to give a trace table for each input. |
||||||
|
9. Conclusion |
||||||
|
10. Short statement about contributions/Reflections from each group member |
||||||
|
11. References |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Deadline to submit written report: On or before Sunday 18th May 2024, 11.59pm via Moodle. |
||||||
|
The report must be: |
||||||
|
1. Word or pdf document (3 to 4 pages long) |
||||||
|
2. Size: A4 |
||||||
|
3. Use Assignment Cover Page (download from Moodle) with your details and signature |
||||||
|
4. Single space |
||||||
|
5. Font: Calibri, 11pt |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,63 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Deduction, Late Submission and Extension |
||||||
|
Late submission penalty: - 5% of the total available marks per calendar day unless an extension is |
||||||
|
approved. For extension application procedure, please refer to Section 3.3 of the Subject Outline. |
||||||
|
|
||||||
|
Plagiarism |
||||||
|
Please read Section 3.4 Plagiarism and Refere ncing, from the Subject Outline. Below is part of the |
||||||
|
statement: |
||||||
|
|
||||||
|
“Students plagiarising run the risk of severe penalties ranging from a reduction through to 0 marks for |
||||||
|
a first offence for a single assessment task, to exclusion from KOI in the most serio us repeat cases. |
||||||
|
Exclusion has serious visa implications.” |
||||||
|
|
||||||
|
“Authorship is also an issue under Plagiarism – KOI expects students to submit their own original work |
||||||
|
in both assessment and exams, or the original work of their group in the case of a group pr oject. All |
||||||
|
students agree to a statement of authorship when submitting assessments online via Moodle, stating |
||||||
|
that the work submitted is their own original work. The following are examples of academic |
||||||
|
misconduct and can attract severe penalties: |
||||||
|
• Handing in work created by someone else (without acknowledgement), whether copied |
||||||
|
from another student, written by someone else, or from any published or electronic |
||||||
|
source, is fraud, and falls under the general Plagiarism guidelines. |
||||||
|
• Students who willingl y allow another student to copy their work in any assessment may |
||||||
|
be considered to assisting in copying/cheating, and similar penalties may be applied. ” |
||||||
|
• Any form of AI usage such as ChatGPT in your assessment is considered as plagiarism. |
||||||
|
|
||||||
|
Marking Rubric for Assessment N. 03 (Individual Assignment) ; Value 50% |
||||||
|
|
||||||
|
Criteria Fail |
||||||
|
(0 – 49%) Pass |
||||||
|
(50 – 64%) Credit |
||||||
|
(65 – 74%) Distinction |
||||||
|
(75 – 84%) High Distinction |
||||||
|
(85 – 100%) |
||||||
|
Understanding of the |
||||||
|
Topic |
||||||
|
4 marks |
||||||
|
Inaccurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Basic |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description of |
||||||
|
the Topic and |
||||||
|
some |
||||||
|
connections |
||||||
|
with |
||||||
|
Information |
||||||
|
Technology Polished |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic |
||||||
|
and |
||||||
|
references to |
||||||
|
Information |
||||||
|
Technology |
@ -0,0 +1,128 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Evidence of depth of |
||||||
|
research with reference |
||||||
|
6 marks Little or no |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references |
||||||
|
with |
||||||
|
explanations |
||||||
|
of |
||||||
|
connections |
||||||
|
to the Topic Relevant |
||||||
|
reading and |
||||||
|
references and |
||||||
|
clear |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic Relevant |
||||||
|
reading and |
||||||
|
refere nces |
||||||
|
and polished |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic |
||||||
|
Identifying an application |
||||||
|
of Information |
||||||
|
Technology relevant to |
||||||
|
the topic |
||||||
|
2 mark Little or no |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Basic |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Accurate |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Accurate and |
||||||
|
comprehensive |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Detail and |
||||||
|
complete |
||||||
|
account of |
||||||
|
application |
||||||
|
of the topic |
||||||
|
to the |
||||||
|
information |
||||||
|
technology |
||||||
|
Understanding of the |
||||||
|
Information technology |
||||||
|
application(s) |
||||||
|
6 marks Inaccurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Basic |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description of |
||||||
|
application of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and some |
||||||
|
connections |
||||||
|
with relevant |
||||||
|
topics Polished |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and |
||||||
|
references to |
||||||
|
relevant |
||||||
|
theories |
||||||
|
Detail description of the |
||||||
|
choice of the application |
||||||
|
7 marks Little or no |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit. Basic |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis and |
||||||
|
complete |
||||||
|
detail |
@ -0,0 +1,129 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Design a plane for |
||||||
|
computer |
||||||
|
implementation |
||||||
|
7 marks Plane is not |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
no flow -chart |
||||||
|
is given Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
flow -chart is |
||||||
|
also given Accurate and |
||||||
|
comprehensive |
||||||
|
plane is given |
||||||
|
with a correct |
||||||
|
flow -chart Appropriate |
||||||
|
plane with |
||||||
|
correct flow - |
||||||
|
chart and |
||||||
|
complete |
||||||
|
detail is |
||||||
|
given. |
||||||
|
Writing an algorithm |
||||||
|
7 marks Inaccurate |
||||||
|
algorithm or |
||||||
|
algorithm is |
||||||
|
given in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm but |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
appropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
little discussion Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
complete |
||||||
|
discussion |
||||||
|
Conclusions |
||||||
|
7 mark s Little or no |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Basic |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of the |
||||||
|
algorithm Complete |
||||||
|
analysis and |
||||||
|
justification |
||||||
|
of accuracy |
||||||
|
of the |
||||||
|
algorithm |
||||||
|
Presentation |
||||||
|
1 mark Poorly |
||||||
|
organised |
||||||
|
report with |
||||||
|
unclear |
||||||
|
structure Well |
||||||
|
organised |
||||||
|
report but |
||||||
|
with some |
||||||
|
errors Clearly |
||||||
|
organised |
||||||
|
report with |
||||||
|
few errors Clearly |
||||||
|
organised |
||||||
|
report and |
||||||
|
good use of |
||||||
|
tables and |
||||||
|
graphs Polished |
||||||
|
report and |
||||||
|
creative use |
||||||
|
of tables and |
||||||
|
graphs |
||||||
|
Presentation |
||||||
|
5 marks Poor quality |
||||||
|
of slides or |
||||||
|
poor |
||||||
|
performance |
||||||
|
of |
||||||
|
presentation Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but some |
||||||
|
error Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but one or |
||||||
|
two error Well prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
correctly Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
explicitly |
||||||
|
with quality. |
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Total Mark: / 25 |
||||||
|
|
||||||
|
25% |
||||||
|
COMMENTS: |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
Discrete Mathematics ICT101 Assessment 3 ( 50%) |
||||||
|
Instructions |
||||||
|
Assessment Type : Individual Assignment |
||||||
|
Purpose of the assessment : To develop a plan for a real -world example of an |
||||||
|
application in information technology from the one of the topics given below . |
||||||
|
This assessment contributes to the various learning outcomes of your Bachelor |
||||||
|
of IT degree. |
||||||
|
|
||||||
|
Assessment Task : In the initial part of assignment, the student will be tested on their skills on |
||||||
|
writing literature review of a topic student have learnt in the Discrete Mathematics (ICT101) course |
||||||
|
in the week 1 to 6. Students need to read at least 3 articles or bo oks on this topic especially with |
||||||
|
application to Information Technology and give detail review of those. Student will also identify one |
||||||
|
application of information Technology related to the topic in which he/she is interested and write a |
||||||
|
complete account of that interest. |
||||||
|
|
||||||
|
Student can use the following database to find article or books. |
||||||
|
o EBSCO Databases |
||||||
|
o Emerald Insight |
||||||
|
o IBISWorld |
||||||
|
o IGI Global |
||||||
|
o ProQuest eBooks |
||||||
|
o O’Reilly Learnin g |
||||||
|
|
||||||
|
Student will be exploring and analysis the application of information technology related to the topic |
||||||
|
which are identified by him/her , and he/she must recognise an application that can be programmed |
||||||
|
into computer. Each group must sketch a plane to draw a flow -chart and algorithm. Use some inputs |
||||||
|
to test the algorithm (Give different trace table for each input) and identify any problem in the |
||||||
|
algorithm. Suggest a plane to rectify or explain why it can ’t be rectified. Each student must write on e |
||||||
|
report on its findings. |
||||||
|
|
@ -0,0 +1,45 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Student can choose one from the following Topic. However, after deciding on the topic to work on , |
||||||
|
consult with your tutor. |
||||||
|
The topic student group can choose from are : |
||||||
|
• Number system used in Computing |
||||||
|
• Logic in computing |
||||||
|
• Inverse Function in Computing |
||||||
|
• Induction Proof and its computing applicatio n |
||||||
|
• 16-bit representation |
||||||
|
• Cryptography |
||||||
|
|
||||||
|
The written report must have the following sections: |
||||||
|
1. Introduction |
||||||
|
2. Proper reference of at least three articles or books |
||||||
|
3. Write detail review of those articles or books related to the topic student chooses |
||||||
|
|
||||||
|
4. Identify one application in Information Technology in which student is interested. |
||||||
|
Write a complete account of that interest |
||||||
|
5. Description of why students choose this application |
||||||
|
6. Give a complete plane to implement the application into a computer program with use of |
||||||
|
flow -chart |
||||||
|
7. Write an appropriate algorithm |
||||||
|
8. Use at least two inputs to test the algor ithm. Group need to give a trace table for each input. |
||||||
|
9. Conclusion |
||||||
|
10. Short statement about contributions/Reflections from each group member |
||||||
|
11. References |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Deadline to submit written report: On or before Sunday 18th May 2024, 11.59pm via Moodle. |
||||||
|
The report must be: |
||||||
|
1. Word or pdf document (3 to 4 pages long) |
||||||
|
2. Size: A4 |
||||||
|
3. Use Assignment Cover Page (download from Moodle) with your details and signature |
||||||
|
4. Single space |
||||||
|
5. Font: Calibri, 11pt |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,63 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Deduction, Late Submission and Extension |
||||||
|
Late submission penalty: - 5% of the total available marks per calendar day unless an extension is |
||||||
|
approved. For extension application procedure, please refer to Section 3.3 of the Subject Outline. |
||||||
|
|
||||||
|
Plagiarism |
||||||
|
Please read Section 3.4 Plagiarism and Refere ncing, from the Subject Outline. Below is part of the |
||||||
|
statement: |
||||||
|
|
||||||
|
“Students plagiarising run the risk of severe penalties ranging from a reduction through to 0 marks for |
||||||
|
a first offence for a single assessment task, to exclusion from KOI in the most serio us repeat cases. |
||||||
|
Exclusion has serious visa implications.” |
||||||
|
|
||||||
|
“Authorship is also an issue under Plagiarism – KOI expects students to submit their own original work |
||||||
|
in both assessment and exams, or the original work of their group in the case of a group pr oject. All |
||||||
|
students agree to a statement of authorship when submitting assessments online via Moodle, stating |
||||||
|
that the work submitted is their own original work. The following are examples of academic |
||||||
|
misconduct and can attract severe penalties: |
||||||
|
• Handing in work created by someone else (without acknowledgement), whether copied |
||||||
|
from another student, written by someone else, or from any published or electronic |
||||||
|
source, is fraud, and falls under the general Plagiarism guidelines. |
||||||
|
• Students who willingl y allow another student to copy their work in any assessment may |
||||||
|
be considered to assisting in copying/cheating, and similar penalties may be applied. ” |
||||||
|
• Any form of AI usage such as ChatGPT in your assessment is considered as plagiarism. |
||||||
|
|
||||||
|
Marking Rubric for Assessment N. 03 (Individual Assignment) ; Value 50% |
||||||
|
|
||||||
|
Criteria Fail |
||||||
|
(0 – 49%) Pass |
||||||
|
(50 – 64%) Credit |
||||||
|
(65 – 74%) Distinction |
||||||
|
(75 – 84%) High Distinction |
||||||
|
(85 – 100%) |
||||||
|
Understanding of the |
||||||
|
Topic |
||||||
|
4 marks |
||||||
|
Inaccurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Basic |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description of |
||||||
|
the Topic and |
||||||
|
some |
||||||
|
connections |
||||||
|
with |
||||||
|
Information |
||||||
|
Technology Polished |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic |
||||||
|
and |
||||||
|
references to |
||||||
|
Information |
||||||
|
Technology |
@ -0,0 +1,128 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Evidence of depth of |
||||||
|
research with reference |
||||||
|
6 marks Little or no |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references |
||||||
|
with |
||||||
|
explanations |
||||||
|
of |
||||||
|
connections |
||||||
|
to the Topic Relevant |
||||||
|
reading and |
||||||
|
references and |
||||||
|
clear |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic Relevant |
||||||
|
reading and |
||||||
|
refere nces |
||||||
|
and polished |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic |
||||||
|
Identifying an application |
||||||
|
of Information |
||||||
|
Technology relevant to |
||||||
|
the topic |
||||||
|
2 mark Little or no |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Basic |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Accurate |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Accurate and |
||||||
|
comprehensive |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Detail and |
||||||
|
complete |
||||||
|
account of |
||||||
|
application |
||||||
|
of the topic |
||||||
|
to the |
||||||
|
information |
||||||
|
technology |
||||||
|
Understanding of the |
||||||
|
Information technology |
||||||
|
application(s) |
||||||
|
6 marks Inaccurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Basic |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description of |
||||||
|
application of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and some |
||||||
|
connections |
||||||
|
with relevant |
||||||
|
topics Polished |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and |
||||||
|
references to |
||||||
|
relevant |
||||||
|
theories |
||||||
|
Detail description of the |
||||||
|
choice of the application |
||||||
|
7 marks Little or no |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit. Basic |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis and |
||||||
|
complete |
||||||
|
detail |
@ -0,0 +1,129 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Design a plane for |
||||||
|
computer |
||||||
|
implementation |
||||||
|
7 marks Plane is not |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
no flow -chart |
||||||
|
is given Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
flow -chart is |
||||||
|
also given Accurate and |
||||||
|
comprehensive |
||||||
|
plane is given |
||||||
|
with a correct |
||||||
|
flow -chart Appropriate |
||||||
|
plane with |
||||||
|
correct flow - |
||||||
|
chart and |
||||||
|
complete |
||||||
|
detail is |
||||||
|
given. |
||||||
|
Writing an algorithm |
||||||
|
7 marks Inaccurate |
||||||
|
algorithm or |
||||||
|
algorithm is |
||||||
|
given in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm but |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
appropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
little discussion Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
complete |
||||||
|
discussion |
||||||
|
Conclusions |
||||||
|
7 mark s Little or no |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Basic |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of the |
||||||
|
algorithm Complete |
||||||
|
analysis and |
||||||
|
justification |
||||||
|
of accuracy |
||||||
|
of the |
||||||
|
algorithm |
||||||
|
Presentation |
||||||
|
1 mark Poorly |
||||||
|
organised |
||||||
|
report with |
||||||
|
unclear |
||||||
|
structure Well |
||||||
|
organised |
||||||
|
report but |
||||||
|
with some |
||||||
|
errors Clearly |
||||||
|
organised |
||||||
|
report with |
||||||
|
few errors Clearly |
||||||
|
organised |
||||||
|
report and |
||||||
|
good use of |
||||||
|
tables and |
||||||
|
graphs Polished |
||||||
|
report and |
||||||
|
creative use |
||||||
|
of tables and |
||||||
|
graphs |
||||||
|
Presentation |
||||||
|
5 marks Poor quality |
||||||
|
of slides or |
||||||
|
poor |
||||||
|
performance |
||||||
|
of |
||||||
|
presentation Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but some |
||||||
|
error Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but one or |
||||||
|
two error Well prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
correctly Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
explicitly |
||||||
|
with quality. |
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Total Mark: / 25 |
||||||
|
|
||||||
|
25% |
||||||
|
COMMENTS: |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 28 KiB |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
Discrete Mathematics ICT101 Assessment 3 ( 50%) |
||||||
|
Instructions |
||||||
|
Assessment Type : Individual Assignment |
||||||
|
Purpose of the assessment : To develop a plan for a real -world example of an |
||||||
|
application in information technology from the one of the topics given below . |
||||||
|
This assessment contributes to the various learning outcomes of your Bachelor |
||||||
|
of IT degree. |
||||||
|
|
||||||
|
Assessment Task : In the initial part of assignment, the student will be tested on their skills on |
||||||
|
writing literature review of a topic student have learnt in the Discrete Mathematics (ICT101) course |
||||||
|
in the week 1 to 6. Students need to read at least 3 articles or bo oks on this topic especially with |
||||||
|
application to Information Technology and give detail review of those. Student will also identify one |
||||||
|
application of information Technology related to the topic in which he/she is interested and write a |
||||||
|
complete account of that interest. |
||||||
|
|
||||||
|
Student can use the following database to find article or books. |
||||||
|
o EBSCO Databases |
||||||
|
o Emerald Insight |
||||||
|
o IBISWorld |
||||||
|
o IGI Global |
||||||
|
o ProQuest eBooks |
||||||
|
o O’Reilly Learnin g |
||||||
|
|
||||||
|
Student will be exploring and analysis the application of information technology related to the topic |
||||||
|
which are identified by him/her , and he/she must recognise an application that can be programmed |
||||||
|
into computer. Each group must sketch a plane to draw a flow -chart and algorithm. Use some inputs |
||||||
|
to test the algorithm (Give different trace table for each input) and identify any problem in the |
||||||
|
algorithm. Suggest a plane to rectify or explain why it can ’t be rectified. Each student must write on e |
||||||
|
report on its findings. |
||||||
|
|
@ -0,0 +1,45 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Student can choose one from the following Topic. However, after deciding on the topic to work on , |
||||||
|
consult with your tutor. |
||||||
|
The topic student group can choose from are : |
||||||
|
• Number system used in Computing |
||||||
|
• Logic in computing |
||||||
|
• Inverse Function in Computing |
||||||
|
• Induction Proof and its computing applicatio n |
||||||
|
• 16-bit representation |
||||||
|
• Cryptography |
||||||
|
|
||||||
|
The written report must have the following sections: |
||||||
|
1. Introduction |
||||||
|
2. Proper reference of at least three articles or books |
||||||
|
3. Write detail review of those articles or books related to the topic student chooses |
||||||
|
|
||||||
|
4. Identify one application in Information Technology in which student is interested. |
||||||
|
Write a complete account of that interest |
||||||
|
5. Description of why students choose this application |
||||||
|
6. Give a complete plane to implement the application into a computer program with use of |
||||||
|
flow -chart |
||||||
|
7. Write an appropriate algorithm |
||||||
|
8. Use at least two inputs to test the algor ithm. Group need to give a trace table for each input. |
||||||
|
9. Conclusion |
||||||
|
10. Short statement about contributions/Reflections from each group member |
||||||
|
11. References |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Deadline to submit written report: On or before Sunday 18th May 2024, 11.59pm via Moodle. |
||||||
|
The report must be: |
||||||
|
1. Word or pdf document (3 to 4 pages long) |
||||||
|
2. Size: A4 |
||||||
|
3. Use Assignment Cover Page (download from Moodle) with your details and signature |
||||||
|
4. Single space |
||||||
|
5. Font: Calibri, 11pt |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,63 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Deduction, Late Submission and Extension |
||||||
|
Late submission penalty: - 5% of the total available marks per calendar day unless an extension is |
||||||
|
approved. For extension application procedure, please refer to Section 3.3 of the Subject Outline. |
||||||
|
|
||||||
|
Plagiarism |
||||||
|
Please read Section 3.4 Plagiarism and Refere ncing, from the Subject Outline. Below is part of the |
||||||
|
statement: |
||||||
|
|
||||||
|
“Students plagiarising run the risk of severe penalties ranging from a reduction through to 0 marks for |
||||||
|
a first offence for a single assessment task, to exclusion from KOI in the most serio us repeat cases. |
||||||
|
Exclusion has serious visa implications.” |
||||||
|
|
||||||
|
“Authorship is also an issue under Plagiarism – KOI expects students to submit their own original work |
||||||
|
in both assessment and exams, or the original work of their group in the case of a group pr oject. All |
||||||
|
students agree to a statement of authorship when submitting assessments online via Moodle, stating |
||||||
|
that the work submitted is their own original work. The following are examples of academic |
||||||
|
misconduct and can attract severe penalties: |
||||||
|
• Handing in work created by someone else (without acknowledgement), whether copied |
||||||
|
from another student, written by someone else, or from any published or electronic |
||||||
|
source, is fraud, and falls under the general Plagiarism guidelines. |
||||||
|
• Students who willingl y allow another student to copy their work in any assessment may |
||||||
|
be considered to assisting in copying/cheating, and similar penalties may be applied. ” |
||||||
|
• Any form of AI usage such as ChatGPT in your assessment is considered as plagiarism. |
||||||
|
|
||||||
|
Marking Rubric for Assessment N. 03 (Individual Assignment) ; Value 50% |
||||||
|
|
||||||
|
Criteria Fail |
||||||
|
(0 – 49%) Pass |
||||||
|
(50 – 64%) Credit |
||||||
|
(65 – 74%) Distinction |
||||||
|
(75 – 84%) High Distinction |
||||||
|
(85 – 100%) |
||||||
|
Understanding of the |
||||||
|
Topic |
||||||
|
4 marks |
||||||
|
Inaccurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Basic |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description of |
||||||
|
the Topic and |
||||||
|
some |
||||||
|
connections |
||||||
|
with |
||||||
|
Information |
||||||
|
Technology Polished |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic |
||||||
|
and |
||||||
|
references to |
||||||
|
Information |
||||||
|
Technology |
@ -0,0 +1,128 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Evidence of depth of |
||||||
|
research with reference |
||||||
|
6 marks Little or no |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references |
||||||
|
with |
||||||
|
explanations |
||||||
|
of |
||||||
|
connections |
||||||
|
to the Topic Relevant |
||||||
|
reading and |
||||||
|
references and |
||||||
|
clear |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic Relevant |
||||||
|
reading and |
||||||
|
refere nces |
||||||
|
and polished |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic |
||||||
|
Identifying an application |
||||||
|
of Information |
||||||
|
Technology relevant to |
||||||
|
the topic |
||||||
|
2 mark Little or no |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Basic |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Accurate |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Accurate and |
||||||
|
comprehensive |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Detail and |
||||||
|
complete |
||||||
|
account of |
||||||
|
application |
||||||
|
of the topic |
||||||
|
to the |
||||||
|
information |
||||||
|
technology |
||||||
|
Understanding of the |
||||||
|
Information technology |
||||||
|
application(s) |
||||||
|
6 marks Inaccurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Basic |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description of |
||||||
|
application of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and some |
||||||
|
connections |
||||||
|
with relevant |
||||||
|
topics Polished |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and |
||||||
|
references to |
||||||
|
relevant |
||||||
|
theories |
||||||
|
Detail description of the |
||||||
|
choice of the application |
||||||
|
7 marks Little or no |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit. Basic |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis and |
||||||
|
complete |
||||||
|
detail |
@ -0,0 +1,129 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Design a plane for |
||||||
|
computer |
||||||
|
implementation |
||||||
|
7 marks Plane is not |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
no flow -chart |
||||||
|
is given Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
flow -chart is |
||||||
|
also given Accurate and |
||||||
|
comprehensive |
||||||
|
plane is given |
||||||
|
with a correct |
||||||
|
flow -chart Appropriate |
||||||
|
plane with |
||||||
|
correct flow - |
||||||
|
chart and |
||||||
|
complete |
||||||
|
detail is |
||||||
|
given. |
||||||
|
Writing an algorithm |
||||||
|
7 marks Inaccurate |
||||||
|
algorithm or |
||||||
|
algorithm is |
||||||
|
given in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm but |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
appropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
little discussion Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
complete |
||||||
|
discussion |
||||||
|
Conclusions |
||||||
|
7 mark s Little or no |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Basic |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of the |
||||||
|
algorithm Complete |
||||||
|
analysis and |
||||||
|
justification |
||||||
|
of accuracy |
||||||
|
of the |
||||||
|
algorithm |
||||||
|
Presentation |
||||||
|
1 mark Poorly |
||||||
|
organised |
||||||
|
report with |
||||||
|
unclear |
||||||
|
structure Well |
||||||
|
organised |
||||||
|
report but |
||||||
|
with some |
||||||
|
errors Clearly |
||||||
|
organised |
||||||
|
report with |
||||||
|
few errors Clearly |
||||||
|
organised |
||||||
|
report and |
||||||
|
good use of |
||||||
|
tables and |
||||||
|
graphs Polished |
||||||
|
report and |
||||||
|
creative use |
||||||
|
of tables and |
||||||
|
graphs |
||||||
|
Presentation |
||||||
|
5 marks Poor quality |
||||||
|
of slides or |
||||||
|
poor |
||||||
|
performance |
||||||
|
of |
||||||
|
presentation Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but some |
||||||
|
error Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but one or |
||||||
|
two error Well prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
correctly Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
explicitly |
||||||
|
with quality. |
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Total Mark: / 25 |
||||||
|
|
||||||
|
25% |
||||||
|
COMMENTS: |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 94 KiB |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
Discrete Mathematics ICT101 Assessment 3 ( 50%) |
||||||
|
Instructions |
||||||
|
Assessment Type : Individual Assignment |
||||||
|
Purpose of the assessment : To develop a plan for a real -world example of an |
||||||
|
application in information technology from the one of the topics given below . |
||||||
|
This assessment contributes to the various learning outcomes of your Bachelor |
||||||
|
of IT degree. |
||||||
|
|
||||||
|
Assessment Task : In the initial part of assignment, the student will be tested on their skills on |
||||||
|
writing literature review of a topic student have learnt in the Discrete Mathematics (ICT101) course |
||||||
|
in the week 1 to 6. Students need to read at least 3 articles or bo oks on this topic especially with |
||||||
|
application to Information Technology and give detail review of those. Student will also identify one |
||||||
|
application of information Technology related to the topic in which he/she is interested and write a |
||||||
|
complete account of that interest. |
||||||
|
|
||||||
|
Student can use the following database to find article or books. |
||||||
|
o EBSCO Databases |
||||||
|
o Emerald Insight |
||||||
|
o IBISWorld |
||||||
|
o IGI Global |
||||||
|
o ProQuest eBooks |
||||||
|
o O’Reilly Learnin g |
||||||
|
|
||||||
|
Student will be exploring and analysis the application of information technology related to the topic |
||||||
|
which are identified by him/her , and he/she must recognise an application that can be programmed |
||||||
|
into computer. Each group must sketch a plane to draw a flow -chart and algorithm. Use some inputs |
||||||
|
to test the algorithm (Give different trace table for each input) and identify any problem in the |
||||||
|
algorithm. Suggest a plane to rectify or explain why it can ’t be rectified. Each student must write on e |
||||||
|
report on its findings. |
||||||
|
|
@ -0,0 +1,45 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Student can choose one from the following Topic. However, after deciding on the topic to work on , |
||||||
|
consult with your tutor. |
||||||
|
The topic student group can choose from are : |
||||||
|
• Number system used in Computing |
||||||
|
• Logic in computing |
||||||
|
• Inverse Function in Computing |
||||||
|
• Induction Proof and its computing applicatio n |
||||||
|
• 16-bit representation |
||||||
|
• Cryptography |
||||||
|
|
||||||
|
The written report must have the following sections: |
||||||
|
1. Introduction |
||||||
|
2. Proper reference of at least three articles or books |
||||||
|
3. Write detail review of those articles or books related to the topic student chooses |
||||||
|
|
||||||
|
4. Identify one application in Information Technology in which student is interested. |
||||||
|
Write a complete account of that interest |
||||||
|
5. Description of why students choose this application |
||||||
|
6. Give a complete plane to implement the application into a computer program with use of |
||||||
|
flow -chart |
||||||
|
7. Write an appropriate algorithm |
||||||
|
8. Use at least two inputs to test the algor ithm. Group need to give a trace table for each input. |
||||||
|
9. Conclusion |
||||||
|
10. Short statement about contributions/Reflections from each group member |
||||||
|
11. References |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Deadline to submit written report: On or before Sunday 18th May 2024, 11.59pm via Moodle. |
||||||
|
The report must be: |
||||||
|
1. Word or pdf document (3 to 4 pages long) |
||||||
|
2. Size: A4 |
||||||
|
3. Use Assignment Cover Page (download from Moodle) with your details and signature |
||||||
|
4. Single space |
||||||
|
5. Font: Calibri, 11pt |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,63 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Deduction, Late Submission and Extension |
||||||
|
Late submission penalty: - 5% of the total available marks per calendar day unless an extension is |
||||||
|
approved. For extension application procedure, please refer to Section 3.3 of the Subject Outline. |
||||||
|
|
||||||
|
Plagiarism |
||||||
|
Please read Section 3.4 Plagiarism and Refere ncing, from the Subject Outline. Below is part of the |
||||||
|
statement: |
||||||
|
|
||||||
|
“Students plagiarising run the risk of severe penalties ranging from a reduction through to 0 marks for |
||||||
|
a first offence for a single assessment task, to exclusion from KOI in the most serio us repeat cases. |
||||||
|
Exclusion has serious visa implications.” |
||||||
|
|
||||||
|
“Authorship is also an issue under Plagiarism – KOI expects students to submit their own original work |
||||||
|
in both assessment and exams, or the original work of their group in the case of a group pr oject. All |
||||||
|
students agree to a statement of authorship when submitting assessments online via Moodle, stating |
||||||
|
that the work submitted is their own original work. The following are examples of academic |
||||||
|
misconduct and can attract severe penalties: |
||||||
|
• Handing in work created by someone else (without acknowledgement), whether copied |
||||||
|
from another student, written by someone else, or from any published or electronic |
||||||
|
source, is fraud, and falls under the general Plagiarism guidelines. |
||||||
|
• Students who willingl y allow another student to copy their work in any assessment may |
||||||
|
be considered to assisting in copying/cheating, and similar penalties may be applied. ” |
||||||
|
• Any form of AI usage such as ChatGPT in your assessment is considered as plagiarism. |
||||||
|
|
||||||
|
Marking Rubric for Assessment N. 03 (Individual Assignment) ; Value 50% |
||||||
|
|
||||||
|
Criteria Fail |
||||||
|
(0 – 49%) Pass |
||||||
|
(50 – 64%) Credit |
||||||
|
(65 – 74%) Distinction |
||||||
|
(75 – 84%) High Distinction |
||||||
|
(85 – 100%) |
||||||
|
Understanding of the |
||||||
|
Topic |
||||||
|
4 marks |
||||||
|
Inaccurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Basic |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description of |
||||||
|
the Topic and |
||||||
|
some |
||||||
|
connections |
||||||
|
with |
||||||
|
Information |
||||||
|
Technology Polished |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic |
||||||
|
and |
||||||
|
references to |
||||||
|
Information |
||||||
|
Technology |
@ -0,0 +1,128 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Evidence of depth of |
||||||
|
research with reference |
||||||
|
6 marks Little or no |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references |
||||||
|
with |
||||||
|
explanations |
||||||
|
of |
||||||
|
connections |
||||||
|
to the Topic Relevant |
||||||
|
reading and |
||||||
|
references and |
||||||
|
clear |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic Relevant |
||||||
|
reading and |
||||||
|
refere nces |
||||||
|
and polished |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic |
||||||
|
Identifying an application |
||||||
|
of Information |
||||||
|
Technology relevant to |
||||||
|
the topic |
||||||
|
2 mark Little or no |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Basic |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Accurate |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Accurate and |
||||||
|
comprehensive |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Detail and |
||||||
|
complete |
||||||
|
account of |
||||||
|
application |
||||||
|
of the topic |
||||||
|
to the |
||||||
|
information |
||||||
|
technology |
||||||
|
Understanding of the |
||||||
|
Information technology |
||||||
|
application(s) |
||||||
|
6 marks Inaccurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Basic |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description of |
||||||
|
application of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and some |
||||||
|
connections |
||||||
|
with relevant |
||||||
|
topics Polished |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and |
||||||
|
references to |
||||||
|
relevant |
||||||
|
theories |
||||||
|
Detail description of the |
||||||
|
choice of the application |
||||||
|
7 marks Little or no |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit. Basic |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis and |
||||||
|
complete |
||||||
|
detail |
@ -0,0 +1,129 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Design a plane for |
||||||
|
computer |
||||||
|
implementation |
||||||
|
7 marks Plane is not |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
no flow -chart |
||||||
|
is given Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
flow -chart is |
||||||
|
also given Accurate and |
||||||
|
comprehensive |
||||||
|
plane is given |
||||||
|
with a correct |
||||||
|
flow -chart Appropriate |
||||||
|
plane with |
||||||
|
correct flow - |
||||||
|
chart and |
||||||
|
complete |
||||||
|
detail is |
||||||
|
given. |
||||||
|
Writing an algorithm |
||||||
|
7 marks Inaccurate |
||||||
|
algorithm or |
||||||
|
algorithm is |
||||||
|
given in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm but |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
appropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
little discussion Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
complete |
||||||
|
discussion |
||||||
|
Conclusions |
||||||
|
7 mark s Little or no |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Basic |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of the |
||||||
|
algorithm Complete |
||||||
|
analysis and |
||||||
|
justification |
||||||
|
of accuracy |
||||||
|
of the |
||||||
|
algorithm |
||||||
|
Presentation |
||||||
|
1 mark Poorly |
||||||
|
organised |
||||||
|
report with |
||||||
|
unclear |
||||||
|
structure Well |
||||||
|
organised |
||||||
|
report but |
||||||
|
with some |
||||||
|
errors Clearly |
||||||
|
organised |
||||||
|
report with |
||||||
|
few errors Clearly |
||||||
|
organised |
||||||
|
report and |
||||||
|
good use of |
||||||
|
tables and |
||||||
|
graphs Polished |
||||||
|
report and |
||||||
|
creative use |
||||||
|
of tables and |
||||||
|
graphs |
||||||
|
Presentation |
||||||
|
5 marks Poor quality |
||||||
|
of slides or |
||||||
|
poor |
||||||
|
performance |
||||||
|
of |
||||||
|
presentation Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but some |
||||||
|
error Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but one or |
||||||
|
two error Well prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
correctly Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
explicitly |
||||||
|
with quality. |
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Total Mark: / 25 |
||||||
|
|
||||||
|
25% |
||||||
|
COMMENTS: |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 94 KiB |
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
Discrete Mathematics ICT101 Assessment 3 ( 50%) |
||||||
|
Instructions |
||||||
|
Assessment Type : Individual Assignment |
||||||
|
Purpose of the assessment : To develop a plan for a real -world example of an |
||||||
|
application in information technology from the one of the topics given below . |
||||||
|
This assessment contributes to the various learning outcomes of your Bachelor |
||||||
|
of IT degree. |
||||||
|
|
||||||
|
Assessment Task : In the initial part of assignment, the student will be tested on their skills on |
||||||
|
writing literature review of a topic student have learnt in the Discrete Mathematics (ICT101) course |
||||||
|
in the week 1 to 6. Students need to read at least 3 articles or bo oks on this topic especially with |
||||||
|
application to Information Technology and give detail review of those. Student will also identify one |
||||||
|
application of information Technology related to the topic in which he/she is interested and write a |
||||||
|
complete account of that interest. |
||||||
|
|
||||||
|
Student can use the following database to find article or books. |
||||||
|
o EBSCO Databases |
||||||
|
o Emerald Insight |
||||||
|
o IBISWorld |
||||||
|
o IGI Global |
||||||
|
o ProQuest eBooks |
||||||
|
o O’Reilly Learnin g |
||||||
|
|
||||||
|
Student will be exploring and analysis the application of information technology related to the topic |
||||||
|
which are identified by him/her , and he/she must recognise an application that can be programmed |
||||||
|
into computer. Each group must sketch a plane to draw a flow -chart and algorithm. Use some inputs |
||||||
|
to test the algorithm (Give different trace table for each input) and identify any problem in the |
||||||
|
algorithm. Suggest a plane to rectify or explain why it can ’t be rectified. Each student must write on e |
||||||
|
report on its findings. |
||||||
|
|
@ -0,0 +1,45 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Student can choose one from the following Topic. However, after deciding on the topic to work on , |
||||||
|
consult with your tutor. |
||||||
|
The topic student group can choose from are : |
||||||
|
• Number system used in Computing |
||||||
|
• Logic in computing |
||||||
|
• Inverse Function in Computing |
||||||
|
• Induction Proof and its computing applicatio n |
||||||
|
• 16-bit representation |
||||||
|
• Cryptography |
||||||
|
|
||||||
|
The written report must have the following sections: |
||||||
|
1. Introduction |
||||||
|
2. Proper reference of at least three articles or books |
||||||
|
3. Write detail review of those articles or books related to the topic student chooses |
||||||
|
|
||||||
|
4. Identify one application in Information Technology in which student is interested. |
||||||
|
Write a complete account of that interest |
||||||
|
5. Description of why students choose this application |
||||||
|
6. Give a complete plane to implement the application into a computer program with use of |
||||||
|
flow -chart |
||||||
|
7. Write an appropriate algorithm |
||||||
|
8. Use at least two inputs to test the algor ithm. Group need to give a trace table for each input. |
||||||
|
9. Conclusion |
||||||
|
10. Short statement about contributions/Reflections from each group member |
||||||
|
11. References |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Deadline to submit written report: On or before Sunday 18th May 2024, 11.59pm via Moodle. |
||||||
|
The report must be: |
||||||
|
1. Word or pdf document (3 to 4 pages long) |
||||||
|
2. Size: A4 |
||||||
|
3. Use Assignment Cover Page (download from Moodle) with your details and signature |
||||||
|
4. Single space |
||||||
|
5. Font: Calibri, 11pt |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,63 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Deduction, Late Submission and Extension |
||||||
|
Late submission penalty: - 5% of the total available marks per calendar day unless an extension is |
||||||
|
approved. For extension application procedure, please refer to Section 3.3 of the Subject Outline. |
||||||
|
|
||||||
|
Plagiarism |
||||||
|
Please read Section 3.4 Plagiarism and Refere ncing, from the Subject Outline. Below is part of the |
||||||
|
statement: |
||||||
|
|
||||||
|
“Students plagiarising run the risk of severe penalties ranging from a reduction through to 0 marks for |
||||||
|
a first offence for a single assessment task, to exclusion from KOI in the most serio us repeat cases. |
||||||
|
Exclusion has serious visa implications.” |
||||||
|
|
||||||
|
“Authorship is also an issue under Plagiarism – KOI expects students to submit their own original work |
||||||
|
in both assessment and exams, or the original work of their group in the case of a group pr oject. All |
||||||
|
students agree to a statement of authorship when submitting assessments online via Moodle, stating |
||||||
|
that the work submitted is their own original work. The following are examples of academic |
||||||
|
misconduct and can attract severe penalties: |
||||||
|
• Handing in work created by someone else (without acknowledgement), whether copied |
||||||
|
from another student, written by someone else, or from any published or electronic |
||||||
|
source, is fraud, and falls under the general Plagiarism guidelines. |
||||||
|
• Students who willingl y allow another student to copy their work in any assessment may |
||||||
|
be considered to assisting in copying/cheating, and similar penalties may be applied. ” |
||||||
|
• Any form of AI usage such as ChatGPT in your assessment is considered as plagiarism. |
||||||
|
|
||||||
|
Marking Rubric for Assessment N. 03 (Individual Assignment) ; Value 50% |
||||||
|
|
||||||
|
Criteria Fail |
||||||
|
(0 – 49%) Pass |
||||||
|
(50 – 64%) Credit |
||||||
|
(65 – 74%) Distinction |
||||||
|
(75 – 84%) High Distinction |
||||||
|
(85 – 100%) |
||||||
|
Understanding of the |
||||||
|
Topic |
||||||
|
4 marks |
||||||
|
Inaccurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Basic |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic Accurate |
||||||
|
mathematical |
||||||
|
description of |
||||||
|
the Topic and |
||||||
|
some |
||||||
|
connections |
||||||
|
with |
||||||
|
Information |
||||||
|
Technology Polished |
||||||
|
mathematical |
||||||
|
description |
||||||
|
of the Topic |
||||||
|
and |
||||||
|
references to |
||||||
|
Information |
||||||
|
Technology |
@ -0,0 +1,128 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Evidence of depth of |
||||||
|
research with reference |
||||||
|
6 marks Little or no |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references Some |
||||||
|
relevant |
||||||
|
reading and |
||||||
|
references |
||||||
|
with |
||||||
|
explanations |
||||||
|
of |
||||||
|
connections |
||||||
|
to the Topic Relevant |
||||||
|
reading and |
||||||
|
references and |
||||||
|
clear |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic Relevant |
||||||
|
reading and |
||||||
|
refere nces |
||||||
|
and polished |
||||||
|
connections |
||||||
|
illuminating |
||||||
|
the Topic |
||||||
|
Identifying an application |
||||||
|
of Information |
||||||
|
Technology relevant to |
||||||
|
the topic |
||||||
|
2 mark Little or no |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Basic |
||||||
|
connection |
||||||
|
between the |
||||||
|
topic and the |
||||||
|
application Accurate |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Accurate and |
||||||
|
comprehensive |
||||||
|
application of |
||||||
|
the topic to |
||||||
|
the |
||||||
|
information |
||||||
|
technology Detail and |
||||||
|
complete |
||||||
|
account of |
||||||
|
application |
||||||
|
of the topic |
||||||
|
to the |
||||||
|
information |
||||||
|
technology |
||||||
|
Understanding of the |
||||||
|
Information technology |
||||||
|
application(s) |
||||||
|
6 marks Inaccurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Basic |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description |
||||||
|
of application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology Accurate |
||||||
|
description of |
||||||
|
application of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and some |
||||||
|
connections |
||||||
|
with relevant |
||||||
|
topics Polished |
||||||
|
description |
||||||
|
of |
||||||
|
application |
||||||
|
of |
||||||
|
information |
||||||
|
Technology |
||||||
|
and |
||||||
|
references to |
||||||
|
relevant |
||||||
|
theories |
||||||
|
Detail description of the |
||||||
|
choice of the application |
||||||
|
7 marks Little or no |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit. Basic |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice. Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis Accurate |
||||||
|
evidence is |
||||||
|
given for the |
||||||
|
choice and |
||||||
|
omit with |
||||||
|
relevant |
||||||
|
analysis and |
||||||
|
complete |
||||||
|
detail |
@ -0,0 +1,129 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Design a plane for |
||||||
|
computer |
||||||
|
implementation |
||||||
|
7 marks Plane is not |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
no flow -chart |
||||||
|
is given Plane is |
||||||
|
designed in a |
||||||
|
proper |
||||||
|
manner and |
||||||
|
flow -chart is |
||||||
|
also given Accurate and |
||||||
|
comprehensive |
||||||
|
plane is given |
||||||
|
with a correct |
||||||
|
flow -chart Appropriate |
||||||
|
plane with |
||||||
|
correct flow - |
||||||
|
chart and |
||||||
|
complete |
||||||
|
detail is |
||||||
|
given. |
||||||
|
Writing an algorithm |
||||||
|
7 marks Inaccurate |
||||||
|
algorithm or |
||||||
|
algorithm is |
||||||
|
given in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm but |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
appropriate |
||||||
|
manner Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
little discussion Correct |
||||||
|
algorithm |
||||||
|
which is |
||||||
|
written in an |
||||||
|
inappropriate |
||||||
|
manner with |
||||||
|
complete |
||||||
|
discussion |
||||||
|
Conclusions |
||||||
|
7 mark s Little or no |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Basic |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of |
||||||
|
the algorithm Accurate |
||||||
|
evidence of |
||||||
|
accuracy of the |
||||||
|
algorithm Complete |
||||||
|
analysis and |
||||||
|
justification |
||||||
|
of accuracy |
||||||
|
of the |
||||||
|
algorithm |
||||||
|
Presentation |
||||||
|
1 mark Poorly |
||||||
|
organised |
||||||
|
report with |
||||||
|
unclear |
||||||
|
structure Well |
||||||
|
organised |
||||||
|
report but |
||||||
|
with some |
||||||
|
errors Clearly |
||||||
|
organised |
||||||
|
report with |
||||||
|
few errors Clearly |
||||||
|
organised |
||||||
|
report and |
||||||
|
good use of |
||||||
|
tables and |
||||||
|
graphs Polished |
||||||
|
report and |
||||||
|
creative use |
||||||
|
of tables and |
||||||
|
graphs |
||||||
|
Presentation |
||||||
|
5 marks Poor quality |
||||||
|
of slides or |
||||||
|
poor |
||||||
|
performance |
||||||
|
of |
||||||
|
presentation Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but some |
||||||
|
error Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
but one or |
||||||
|
two error Well prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
correctly Well |
||||||
|
prepared |
||||||
|
presentation |
||||||
|
without an |
||||||
|
error and |
||||||
|
explain |
||||||
|
everything |
||||||
|
explicitly |
||||||
|
with quality. |
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
|
||||||
|
Assessment 3 Instructions INT2024 |
||||||
|
Total Mark: / 25 |
||||||
|
|
||||||
|
25% |
||||||
|
COMMENTS: |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 301 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 3.9 MiB |
@ -0,0 +1 @@ |
|||||||
|
declare module 'js-cookie'; |
@ -1,4 +1,21 @@ |
|||||||
/** @type {import('next').NextConfig} */ |
/** @type {import('next').NextConfig} */ |
||||||
const nextConfig = {}; |
const nextConfig = { |
||||||
|
images: { |
||||||
|
remotePatterns: [ |
||||||
|
{ |
||||||
|
protocol: 'https', |
||||||
|
hostname: '**', |
||||||
|
port: '', |
||||||
|
pathname: '**', |
||||||
|
search: '', |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
webpack: (config) => { |
||||||
|
config.resolve.alias.canvas = false; |
||||||
|
|
||||||
|
return config; |
||||||
|
}, |
||||||
|
}; |
||||||
|
|
||||||
export default nextConfig; |
export default nextConfig; |
||||||
|
@ -0,0 +1,113 @@ |
|||||||
|
import DataTable from "@/components/(dashboard)/common/DataTable/DataTable" |
||||||
|
import { Button } from "@/components/(dashboard)/ui/button" |
||||||
|
import { Badge } from "@/components/ui/badge" |
||||||
|
import { routes } from "@/lib/routes" |
||||||
|
import { ColumnDef } from "@tanstack/react-table" |
||||||
|
import { ArrowUpDown } from "lucide-react" |
||||||
|
|
||||||
|
const CategoryTable: React.FC<{ |
||||||
|
mutate: () => void |
||||||
|
Data: Array<any> |
||||||
|
isLoading: boolean |
||||||
|
}> = ({ |
||||||
|
mutate, |
||||||
|
Data, |
||||||
|
isLoading |
||||||
|
}) => { |
||||||
|
|
||||||
|
const columns: ColumnDef<any>[] = [ |
||||||
|
{ |
||||||
|
accessorKey: "sn", |
||||||
|
header: "SN", |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="capitalize">{row.index + 1}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'name', |
||||||
|
accessorFn: (row: any) => row.original?.name, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Name |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="capitalize"> |
||||||
|
<p>{row.original?.name}</p> |
||||||
|
</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'description', |
||||||
|
accessorFn: (row: any) => row.original?.description, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
className="!px-0" |
||||||
|
> |
||||||
|
Description |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="max-w-[300px] truncate">{row.original?.description ?? '-'}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'creationDate', |
||||||
|
accessorFn: (row: any) => row.original?.creationDate, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Created Date |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="whitespace-nowrap"> |
||||||
|
{row.original?.creationDate ? new Date(row.original.creationDate).toLocaleDateString() : '-'} |
||||||
|
</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'isActive', |
||||||
|
accessorFn: (row: any) => row.original?.isActive, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Status |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div>{row.original?.isActive ? <Badge variant={'success'}>Active</Badge> : <Badge variant={'destructive'}>Deactive</Badge>}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
] |
||||||
|
|
||||||
|
return( |
||||||
|
<> |
||||||
|
<DataTable |
||||||
|
data={Data} |
||||||
|
columns={columns} |
||||||
|
mutate={mutate} |
||||||
|
searchKey="name" |
||||||
|
isLoading={isLoading} |
||||||
|
/> |
||||||
|
</> |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
export default CategoryTable |
@ -0,0 +1,49 @@ |
|||||||
|
'use client' |
||||||
|
import BreadCrumbNav from "@/components/(dashboard)/common/BreadCumbNav/BreadCrumbNav" |
||||||
|
import ContentContainer from "@/components/(dashboard)/elements/ContentContainer" |
||||||
|
import { PageHeading } from "@/components/(dashboard)/ui/title" |
||||||
|
import CommonContainer from "@/components/elements/CommonContainer" |
||||||
|
import AppContextProvider from "@/helpers/context/AppContextProvider" |
||||||
|
import { defaultFetcher } from "@/helpers/fetch.helper" |
||||||
|
import { routes } from "@/lib/routes" |
||||||
|
import { APP_BASE_URL } from "@/utils/constants" |
||||||
|
import AdminView from "@/views/AdminView" |
||||||
|
import useSWR from "swr" |
||||||
|
import CategoryTable from "./_partials/CategoryTable" |
||||||
|
|
||||||
|
|
||||||
|
const CategoryIndexPage = () => { |
||||||
|
const CategoryListURL = `${APP_BASE_URL}/api/courses/getCategories` |
||||||
|
const { data, mutate, isLoading } = useSWR(CategoryListURL, defaultFetcher); |
||||||
|
|
||||||
|
return( |
||||||
|
<AppContextProvider> |
||||||
|
<AdminView> |
||||||
|
<CommonContainer> |
||||||
|
<PageHeading>Categories</PageHeading> |
||||||
|
<BreadCrumbNav breadCrumbItems={[ |
||||||
|
{ |
||||||
|
title: 'Dashboard', |
||||||
|
href: routes.DASHBOARD_ROUTE |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: 'Categories', |
||||||
|
href: routes.CATEGORY_INDEX_PAGE |
||||||
|
}, |
||||||
|
]}/> |
||||||
|
<ContentContainer> |
||||||
|
<div> |
||||||
|
<CategoryTable |
||||||
|
mutate={mutate} |
||||||
|
isLoading={isLoading} |
||||||
|
Data={data || []} |
||||||
|
/> |
||||||
|
</div> |
||||||
|
</ContentContainer> |
||||||
|
</CommonContainer> |
||||||
|
</AdminView> |
||||||
|
</AppContextProvider> |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
export default CategoryIndexPage |
@ -0,0 +1,172 @@ |
|||||||
|
import DataTable from "@/components/(dashboard)/common/DataTable/DataTable" |
||||||
|
import { Button } from "@/components/(dashboard)/ui/button" |
||||||
|
import { Avatar, AvatarImage } from "@/components/ui/avatar" |
||||||
|
import { Badge } from "@/components/ui/badge" |
||||||
|
import { ColumnDef } from "@tanstack/react-table" |
||||||
|
import { ArrowUpDown } from "lucide-react" |
||||||
|
|
||||||
|
const CourseTable: React.FC<{ |
||||||
|
mutate: () => void |
||||||
|
Data: Array<any> |
||||||
|
isLoading: boolean |
||||||
|
}> = ({ |
||||||
|
mutate, |
||||||
|
Data, |
||||||
|
isLoading |
||||||
|
}) => { |
||||||
|
|
||||||
|
const columns: ColumnDef<any>[] = [ |
||||||
|
{ |
||||||
|
accessorKey: "sn", |
||||||
|
header: "SN", |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="capitalize">{row.index + 1}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'name', |
||||||
|
accessorFn: (row: any) => row.original?.name, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Name |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="capitalize flex gap-2"> |
||||||
|
<Avatar className="h-8 w-8"> |
||||||
|
<AvatarImage |
||||||
|
src={row.original?.coverImage ?? 'no image path'} |
||||||
|
alt={row.original?.name} |
||||||
|
/> |
||||||
|
</Avatar> |
||||||
|
<p>{row.original?.name}</p> |
||||||
|
</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'description', |
||||||
|
accessorFn: (row: any) => row.original?.description, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
className="!px-0" |
||||||
|
> |
||||||
|
Description |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="max-w-[300px] truncate">{row.original?.description ?? '-'}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'author', |
||||||
|
accessorFn: (row: any) => row.original?.author?.firstName, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
className="!px-0" |
||||||
|
> |
||||||
|
Author |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div>{row.original?.author?.firstName} {row.original?.author?.lastName}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'category', |
||||||
|
accessorFn: (row: any) => row.original?.category?.name, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Category |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="capitalize">{row.original?.category?.name}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'creationDate', |
||||||
|
accessorFn: (row: any) => row.original?.creationDate, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Published Date |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div className="whitespace-nowrap"> |
||||||
|
{row.original?.creationDate ? new Date(row.original.creationDate).toLocaleDateString() : '-'} |
||||||
|
</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'isActive', |
||||||
|
accessorFn: (row: any) => row.original?.isActive, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Status |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div>{row.original?.isActive ? <Badge variant={'success'}>Active</Badge> : <Badge variant={'destructive'}>Deactive</Badge>}</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 'totalEnrolled', |
||||||
|
accessorFn: (row: any) => row.original?.totalEnrolled, |
||||||
|
header: ({ column }) => ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="!px-0" |
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} |
||||||
|
> |
||||||
|
Students |
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" /> |
||||||
|
</Button> |
||||||
|
), |
||||||
|
cell: ({ row }) => ( |
||||||
|
<div> |
||||||
|
{row.original?.totalEnrolled ?? '-'} |
||||||
|
</div> |
||||||
|
), |
||||||
|
}, |
||||||
|
] |
||||||
|
|
||||||
|
return( |
||||||
|
<> |
||||||
|
<DataTable |
||||||
|
data={Data} |
||||||
|
columns={columns} |
||||||
|
mutate={mutate} |
||||||
|
searchKey="name" |
||||||
|
isLoading={isLoading} |
||||||
|
/> |
||||||
|
</> |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
export default CourseTable |
@ -0,0 +1,48 @@ |
|||||||
|
'use client' |
||||||
|
import BreadCrumbNav from "@/components/(dashboard)/common/BreadCumbNav/BreadCrumbNav" |
||||||
|
import ContentContainer from "@/components/(dashboard)/elements/ContentContainer" |
||||||
|
import { PageHeading } from "@/components/(dashboard)/ui/title" |
||||||
|
import CommonContainer from "@/components/elements/CommonContainer" |
||||||
|
import AppContextProvider from "@/helpers/context/AppContextProvider" |
||||||
|
import { defaultFetcher } from "@/helpers/fetch.helper" |
||||||
|
import { routes } from "@/lib/routes" |
||||||
|
import { APP_BASE_URL } from "@/utils/constants" |
||||||
|
import AdminView from "@/views/AdminView" |
||||||
|
import useSWR from "swr" |
||||||
|
import CourseTable from "./_partials/CourseTable" |
||||||
|
|
||||||
|
const CourseIndexPage = () => { |
||||||
|
const CourseListURL = `${APP_BASE_URL}/api/course/listAll` |
||||||
|
const { data, mutate, isLoading } = useSWR(CourseListURL, defaultFetcher); |
||||||
|
|
||||||
|
return ( |
||||||
|
<AppContextProvider> |
||||||
|
<AdminView> |
||||||
|
<CommonContainer> |
||||||
|
<PageHeading>Courses</PageHeading> |
||||||
|
<BreadCrumbNav breadCrumbItems={[ |
||||||
|
{ |
||||||
|
title: 'Dashboard', |
||||||
|
href: routes.DASHBOARD_ROUTE |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: 'Courses', |
||||||
|
href: routes.COURSE_INDEX_PAGE |
||||||
|
}, |
||||||
|
]}/> |
||||||
|
<ContentContainer> |
||||||
|
<div> |
||||||
|
<CourseTable |
||||||
|
mutate={mutate} |
||||||
|
isLoading={isLoading} |
||||||
|
Data={data?.data || []} |
||||||
|
/> |
||||||
|
</div> |
||||||
|
</ContentContainer> |
||||||
|
</CommonContainer> |
||||||
|
</AdminView> |
||||||
|
</AppContextProvider> |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
export default CourseIndexPage |
@ -0,0 +1,20 @@ |
|||||||
|
'use client' |
||||||
|
import CommonContainer from "@/components/(dashboard)/elements/CommonContainer" |
||||||
|
import AppContextProvider from "@/helpers/context/AppContextProvider" |
||||||
|
import AdminView from "@/views/AdminView" |
||||||
|
|
||||||
|
const DashBoardIndexPage = () => { |
||||||
|
return( |
||||||
|
<> |
||||||
|
<AppContextProvider> |
||||||
|
<AdminView> |
||||||
|
<CommonContainer> |
||||||
|
<h2>hello</h2> |
||||||
|
</CommonContainer> |
||||||
|
</AdminView> |
||||||
|
</AppContextProvider> |
||||||
|
</> |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
export default DashBoardIndexPage |