Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team 35
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ehsan Soltan Mohammadzadeh (ehs227)
Team 35
Commits
74a4202d
Commit
74a4202d
authored
2 years ago
by
Gian Bustamante (gib650)
Browse files
Options
Downloads
Patches
Plain Diff
Update QueueingApp/src/main/java/appQueue/CustomerQueue.java
parent
1590444e
No related branches found
No related tags found
8 merge requests
!20
Update QueueingApp/src/main/webapp/workerLogin.jsp,...
,
!19
Update QueueingApp/src/main/webapp/workerLogin.jsp,...
,
!18
Update QueueingApp/src/main/webapp/workerLogin.jsp,...
,
!17
Update QueueingApp/src/main/webapp/workerLogin.jsp,...
,
!16
Update QueueingApp/src/main/webapp/workerAddsCustomer.jsp,...
,
!14
Update QueueingApp/src/main/webapp/workerLogin.jsp,...
,
!13
all updates to MAIN
,
!12
Walk through v2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
QueueingApp/src/main/java/appQueue/CustomerQueue.java
+36
-0
36 additions, 0 deletions
QueueingApp/src/main/java/appQueue/CustomerQueue.java
with
36 additions
and
0 deletions
QueueingApp/src/main/java/appQueue/CustomerQueue.java
+
36
−
0
View file @
74a4202d
...
@@ -163,8 +163,44 @@ public final class CustomerQueue{
...
@@ -163,8 +163,44 @@ public final class CustomerQueue{
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
updateAvgTime
();
updateQueue
();
updateQueue
();
}
}
public
static
void
updateAvgTime
()
{
try
{
Connection
connection
=
dao
.
createConnection
();
//Update each position
Statement
sta
=
connection
.
createStatement
();
ResultSet
res
=
sta
.
executeQuery
(
"SELECT * FROM `registration`.`customers` ORDER BY `position`;"
);
while
(
res
.
next
())
{
//prepare the statement
String
update_customer
=
"UPDATE registration.customers SET avgWaiting = ? WHERE email = ? ;"
;
PreparedStatement
prepared_statement
=
connection
.
prepareStatement
(
update_customer
);
//1st position customer should only have 5 mins of waiting time
if
(
Integer
.
parseInt
(
res
.
getString
(
"position"
))
==
1
)
{
prepared_statement
.
setString
(
1
,
Integer
.
toString
(
5
));
prepared_statement
.
setString
(
2
,
res
.
getString
(
"email"
));
}
else
{
Integer
newAvgTime
=
10
*
Integer
.
parseInt
(
res
.
getString
(
"position"
));
prepared_statement
.
setString
(
1
,
Integer
.
toString
(
newAvgTime
));
prepared_statement
.
setString
(
2
,
res
.
getString
(
"email"
));
}
//execute query
prepared_statement
.
executeUpdate
();
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
updateQueue
()
{
public
static
void
updateQueue
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment