Skip to content

Commit

Permalink
var change to Const
Browse files Browse the repository at this point in the history
  • Loading branch information
Shibily-kms committed May 15, 2023
1 parent 1f04c45 commit c73e69f
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 48 deletions.
18 changes: 9 additions & 9 deletions controllers/admin/group-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const getGroupViewPage = async (req, res) => {
}

const getGroupStudentsList = async (req, res) => {
var Event = req.session.event
var GroupId = req.params.GroupId
const Event = req.session.event
const GroupId = req.params.GroupId
let GroupDetails = await groupHelpers.getGroupDetails(GroupId, Event.EventId)
let Category = req.params.Category
let EventLimit = await itemHelpers.findOneItemInCategory(Event.EventId, Category)
Expand All @@ -51,7 +51,7 @@ const getGroupStudentsList = async (req, res) => {
}

const getAddStudentPage = async (req, res) => {
var Event = req.session.event
const Event = req.session.event
let GroupDetails = await groupHelpers.getGroupDetails(req.params.GroupId, Event.EventId)
let Category = req.params.Category

Expand Down Expand Up @@ -93,9 +93,9 @@ const postAddStudent = async (req, res) => {
}

const deleteStudent = (req, res) => {
var EventId = req.session.event.EventId
var GroupId = req.params.GroupId
var Category = req.params.Category
const EventId = req.session.event.EventId
const GroupId = req.params.GroupId
const Category = req.params.Category
let ChestNo = req.params.ChestNo
studentHelpers.removeStudent(EventId, GroupId, ChestNo, Category).then((response) => {
res.redirect('/event/' + EventId + '/groups/' + GroupId + '/' + Category + '/students')
Expand Down Expand Up @@ -127,9 +127,9 @@ const getStudentsEventPage = async (req, res) => {
}

const deleteItemFormStudent = async (req, res) => {
var EventId = req.session.event.EventId
var GroupId = req.params.GroupId
var Category = req.params.Category
const EventId = req.session.event.EventId
const GroupId = req.params.GroupId
const Category = req.params.Category
let ChestNo = req.params.ChestNo
let ItemId = req.params.ItemId

Expand Down
2 changes: 1 addition & 1 deletion controllers/admin/items-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const getAddItemPage = async (req, res) => {
const Event = req.session.event
const Category = req.params.Category
const SubCategory = req.params.SubCategory
var pointCategoryOptions = await eventHelpers.getPointCategoryOptions(Event.EventId)
const pointCategoryOptions = await eventHelpers.getPointCategoryOptions(Event.EventId)

if (req.session.Success) {
res.render('event/items/add-item', {
Expand Down
10 changes: 5 additions & 5 deletions controllers/admin/mark-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ const getAddGroupMarkPage = async (req, res) => {
}

const postAddGroupMarkPage = (req, res) => {
var Event = req.session.event
var Category = req.params.Category
var SubCategory = req.params.SubCategory
var ItemId = req.params.ItemId
var ItemName = req.params.ItemName
const Event = req.session.event
const Category = req.params.Category
const SubCategory = req.params.SubCategory
const ItemId = req.params.ItemId
const ItemName = req.params.ItemName

markHelpers.addGroupMark(req.body, Event.EventId, Category, SubCategory, ItemId).then(() => {
res.redirect('/event/' + Event.EventId + '/mark/' + Category + '-' + SubCategory + '/Group/' + ItemId + '-' + ItemName + '/add-mark')
Expand Down
20 changes: 10 additions & 10 deletions controllers/admin/result-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const getCategoryBaisePublishedStatus = async (req, res) => {

const getItemBaiseResultPage = async (req, res) => {
let Event = req.session.event
var ItemCategorys = await itemHelpers.getAllItemCategory(Event.EventId)
const ItemCategorys = await itemHelpers.getAllItemCategory(Event.EventId)

res.render('event/result/item-baise', {
title: Event.Name, eventHeader: true, Event, createAccout: true, adminHeader: true,
Expand All @@ -44,9 +44,9 @@ const searchItemBaise = (req, res) => {

const getItemBaiseSubPage = async (req, res) => {
let Event = req.session.event
var Category = req.params.Category
var SubCategory = req.params.SubCategory
var allItems = await itemHelpers.getAllItems(Event.EventId, Category, SubCategory)
const Category = req.params.Category
const SubCategory = req.params.SubCategory
const allItems = await itemHelpers.getAllItems(Event.EventId, Category, SubCategory)

res.render('event/result/category-item', {
title: Event.Name, eventHeader: true, Event, createAccout: true, adminHeader: true, SubCategory, Category,
Expand Down Expand Up @@ -83,8 +83,8 @@ const getItemBaiseGroupStudents = async (req, res) => {
}

const getStudentBaiseResultPage = async (req, res) => {
var Event = req.session.event
var AllGroups = await groupHelpers.getAllGroups(Event.EventId)
const Event = req.session.event
const AllGroups = await groupHelpers.getAllGroups(Event.EventId)

res.render('event/result/student-baise', { title: Event.Name, eventHeader: true, Event, createAccout: true, adminHeader: true, AllGroups })
}
Expand All @@ -106,8 +106,8 @@ const getStudentBaiseSubPage = async (req, res) => {
}

const getStudentBaiseList = async (req, res) => {
var Event = req.session.event
var GroupId = req.params.GroupId
const Event = req.session.event
const GroupId = req.params.GroupId
let GroupDetails = await groupHelpers.getGroupDetails(GroupId, Event.EventId)
let Category = req.params.Category
let AllStudents = await studentHelpers.getAllStudentsInGroup(Event.EventId, GroupId, Category)
Expand All @@ -119,8 +119,8 @@ const getStudentBaiseList = async (req, res) => {
}

const getStudentBaiseItems = async (req, res) => {
var Event = req.session.event
var GroupId = req.params.GroupId
const Event = req.session.event
const GroupId = req.params.GroupId
let Category = req.params.Category
let ChestNo = req.params.ChestNo
let GroupDetails = await groupHelpers.getGroupDetails(GroupId, Event.EventId)
Expand Down
2 changes: 1 addition & 1 deletion controllers/group/item-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const getItemStudents = async (req, res) => {
let SubCategory = req.params.SubCategory
let ItemId = req.params.ItemId
let ItemName = req.params.ItemName
var Event = await eventHelpers.getEventDetails(Group.EventId)
const Event = await eventHelpers.getEventDetails(Group.EventId)
let ItemStudents = await itemHelpers.getItemStudentsFromOneGroup(Group.EventId, Group.GroupId, ItemId)
let GroupDetails = await groupHelpers.getGroupDetails(Group.GroupId, Group.EventId)
if (req.session.Success) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/group/notification-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const readAllNotifi = (req, res) => {

const viewNotifi = async (req, res) => {
let Group = req.session.group
var EventDetails = await eventHelpers.getEventDetails(Group.EventId)
const EventDetails = await eventHelpers.getEventDetails(Group.EventId)
let MessageId = req.params.MessageId
let Message = await notificationHelpers.getOneMessage(Group.EventId, Group.GroupId, MessageId)
res.render('group/notifi/view-notification', {
Expand Down
8 changes: 4 additions & 4 deletions controllers/group/students-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const getStudentViewpage = async (req, res) => {
let Category = req.params.Category
let Group = req.session.group
let ChestNo = req.params.ChestNo
var Event = await eventHelpers.getEventDetails(Group.EventId)
const Event = await eventHelpers.getEventDetails(Group.EventId)
let Student = await studentHelpers.getOneStudentItems(Group.EventId, ChestNo)
let EventLimit = await itemHelpers.findOneItemInCategory(Group.EventId, Category)

Expand Down Expand Up @@ -142,16 +142,16 @@ const postStudentEditPage = (req, res) => {
})
}
const deleteStudent = (req, res) => {
var Group = req.session.group
var Category = req.params.Category
const Group = req.session.group
const Category = req.params.Category
let ChestNo = req.params.ChestNo
studentHelpers.removeStudent(Group.EventId, Group.GroupId, ChestNo, Category).then((response) => {
res.redirect('/group/students/' + Category)
})
}

const getStudentWithOutItem = async (req, res) => {
var Group = req.session.group
const Group = req.session.group
studentHelpers.GroupBaiseStudentWithOutItems(Group.EventId, Group.GroupId).then((Students) => {
res.render('group/students/student-without-item', { title: Group.GroupName, group: true, groupHeader: true, Group, Students })
})
Expand Down
8 changes: 4 additions & 4 deletions controllers/user/result-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ const getStudentBaiseSubPage = async (req, res) => {
}

const getStudentBaiseList = async (req, res) => {
var eventDetails = req.session.e
var GroupId = req.params.GroupId
const eventDetails = req.session.e
const GroupId = req.params.GroupId
let GroupDetails = await groupHelpers.getGroupDetails(GroupId, eventDetails.EventId)
let Category = req.params.Category
let AllStudents = await studentHelpers.getAllStudentsInGroup(eventDetails.EventId, GroupId, Category)
Expand All @@ -103,8 +103,8 @@ const getStudentBaiseList = async (req, res) => {
}

const getStudentBaiseItems = async (req, res) => {
var eventDetails = req.session.e
var GroupId = req.params.GroupId
const eventDetails = req.session.e
const GroupId = req.params.GroupId
let Category = req.params.Category
let ChestNo = req.params.ChestNo
let GroupDetails = await groupHelpers.getGroupDetails(GroupId, eventDetails.EventId)
Expand Down
4 changes: 2 additions & 2 deletions helpers/event-helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var db = require('../config/db')
var collection = require('../config/collections')
const db = require('../config/db')
const collection = require('../config/collections')
const bcrypt = require('bcrypt')
const { createRandomId } = require('./function-helpers')

Expand Down
4 changes: 2 additions & 2 deletions helpers/mark-helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var db = require('../config/db')
var collection = require('../config/collections')
const db = require('../config/db')
const collection = require('../config/collections')
const eventHelpers = require('./event-helpers');
const studentHelpers = require('./student-helpers');
const itemHelpers = require('./item-helpers');
Expand Down
12 changes: 6 additions & 6 deletions helpers/user-helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var db = require('../config/db')
var collection = require('../config/collections')
const db = require('../config/db')
const collection = require('../config/collections')


module.exports = {
Expand Down Expand Up @@ -45,10 +45,10 @@ module.exports = {
} else {

let searchValue = body.searchValue;
var myPattern = new RegExp('(\\w*' + searchValue + '\\w*)', 'gi');
const myPattern = new RegExp('(\\w*' + searchValue + '\\w*)', 'gi');

for (let b = 0; b < AllStudents.length; b++) {
var Group = await db.get().collection(collection.GROUP_COLLECTION).findOne({ FestId: body.FestId, GroupId: AllStudents[b].GroupId })
const Group = await db.get().collection(collection.GROUP_COLLECTION).findOne({ FestId: body.FestId, GroupId: AllStudents[b].GroupId })

let searchName = AllStudents[b].FullName.split(/\s/)
let NameString = null
Expand All @@ -57,8 +57,8 @@ module.exports = {
NameString = searchName[c].slice(0, searchValue.length).match(myPattern)
}
}
var searchChestNo = AllStudents[b].ChestNo.slice(0, searchValue.length).match(myPattern);
var searchCIC = AllStudents[b].CicNo.slice(0, searchValue.length).match(myPattern);
const searchChestNo = AllStudents[b].ChestNo.slice(0, searchValue.length).match(myPattern);
const searchCIC = AllStudents[b].CicNo.slice(0, searchValue.length).match(myPattern);

let student = {}
student.GroupName = Group.GroupName
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "event",
"version": "2.1.2",
"version": "2.1.",
"private": true,
"scripts": {
"start": "nodemon ./bin/www"
Expand Down
4 changes: 2 additions & 2 deletions routes/group.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var express = require('express');
var router = express.Router();
const express = require('express');
const router = express.Router();
const { verifyGroupLogin } = require('../middleware/verify-middleware')


Expand Down

0 comments on commit c73e69f

Please sign in to comment.