commit 0da3c42ee753c4cc4af12b589134b88a0adaa95b
parent d9f26e3d76718dbe9a6de8270736d47f50d7d7ef
Author: Youth Employment Program Production <youthemployment22@gmail.com>
Date: Thu, 6 Jul 2023 21:19:10 -0600
change time_collection.project to store ObjectId()
Diffstat:
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/app/routes.py b/app/routes.py
@@ -292,7 +292,7 @@ def dashboard():
mongo.db.time_collection.insert_one({'clock_in' : [datetime.datetime.now()],
'modified_by' : [current_user.username],
'date' : datetime.datetime.today(),
- 'project' : clockinform.projectsSel.data})
+ 'project' : ObjectId(clockinform.projectsSel.data)})
return redirect(url_for('dashboard'))
# Can still clock in without checking current vehicle status!!! TODO FIX ME !!!
@@ -503,7 +503,7 @@ def clockin_new_user():
mongo.db.time_collection.insert_one({'clock_in' : [form.time.data],
'modified_by' : [form.userSel.data, current_user.username],
'date' : datetime.datetime.today(),
- 'project' : form.projectSel.data})
+ 'project' : ObjectId(form.projectSel.data)})
return redirect(url_for('dashboard'))
return render_template('dashboard/punchclock/otheruser.html',form=form,ORGNAME=OrganizationName)
@@ -541,7 +541,7 @@ def new_time(usernm):
'date' : dateentry,
'clock_in' : [starttime],
'clock_out' : [endtime],
- 'project' : form.projectSel.data,
+ 'project' : ObjectId(form.projectSel.data),
'lunch': form.lunchSel.data,
'per_diem':form.perDiemSel.data})
else:
@@ -550,7 +550,7 @@ def new_time(usernm):
'date' : dateentry,
'clock_in' : [starttime],
'clock_out' : [endtime],
- 'project' : form.projectSel.data,
+ 'project' : ObjectId(form.projectSel.data),
'lunch': form.lunchSel.data,
'per_diem':form.perDiemSel.data})
@@ -595,7 +595,7 @@ def new_user_time():
'date' : dateentry,
'clock_in' : [starttime],
'clock_out' : [endtime],
- 'project' : form.projectSel.data,
+ 'project' : ObjectId(form.projectSel.data),
'lunch': form.lunchSel.data,
'per_diem':form.perDiemSel.data})
else:
@@ -604,7 +604,7 @@ def new_user_time():
'date' : dateentry,
'clock_in' : [starttime],
'clock_out' : [endtime],
- 'project' : form.projectSel.data,
+ 'project' : ObjectId(form.projectSel.data),
'lunch': form.lunchSel.data,
'per_diem':form.perDiemSel.data})
@@ -622,7 +622,7 @@ def clockin_by_id(modusernm,usertoinid,project,intime):
mongo.db.time_collection.insert_one({'_id':timeid,
'modified_by' :[user2[0], modusernm],
'clock_in' : [datetime.datetime.strptime(intime, '%Y-%m-%d %H:%M:%S.%f')],
- 'project' : project[0]})
+ 'project' : ObjectId(project[0])})
return redirect(url_for('dashboard'))
@@ -759,7 +759,7 @@ def hours(username):#userid goes into call to db to get user[] -> then returns f
mongo.db.time_collection.insert_one({'clock_in' : [indt],
'modified_by' : [current_user.username],
'date' : datetime.datetime.today(),
- 'project' : form.projectSel.data,
+ 'project' : ObjectId(form.projectSel.data),
'clock_out':[outdt]})
return redirect(url_for('hours',username=user['username']))
@@ -767,7 +767,7 @@ def hours(username):#userid goes into call to db to get user[] -> then returns f
mongo.db.time_collection.insert_one({'clock_in' : [indt],
'modified_by' : [user['username'], current_user.username],
'date' : datetime.datetime.today(),
- 'project' : form.projectSel.data,
+ 'project' : ObjectId(form.projectSel.data),
'clock_out':[outdt]})
return redirect(url_for('hours',username=user['username']))
@@ -1025,11 +1025,11 @@ def project(project_id):
else:
#for project in agreement['projects']:
try:
- tme = mongo.db.time_collection.find({'project':project_id})
+ tme = mongo.db.time_collection.find({'project':probject_id})
if tme is None:
- flash('No Current Hours submitted for project {}'.format(project_id))
+ flash('No Current Hours submitted for project {}'.format(probject_id))
except:
- flash("Issue assigning time data for project id {}".format(project_id))
+ flash("Issue assigning time data for project id {}".format(probject_id))
else:
for time in tme:
payperiod_times.append(time)