Spaces:
Sleeping
Sleeping
change
Browse files- RemoveSkills.py +32 -8
- SkillExtractV1.py +1 -1
RemoveSkills.py
CHANGED
@@ -3,13 +3,37 @@ import pymysql
|
|
3 |
from DbConnection import DbConnection
|
4 |
class RemoveSkill:
|
5 |
def RemoveSkillDetails(SkillName):
|
6 |
-
|
7 |
-
|
8 |
-
cursor =
|
9 |
-
|
10 |
-
query = "
|
11 |
-
params = (SkillName.upper(),)
|
12 |
cursor.execute(query, params)
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
cursor.close()
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
3 |
from DbConnection import DbConnection
|
4 |
class RemoveSkill:
|
5 |
def RemoveSkillDetails(SkillName):
|
6 |
+
returnMsg=''
|
7 |
+
conn = DbConnection.GetMySQLDbConnection()
|
8 |
+
cursor = conn.cursor()
|
9 |
+
|
10 |
+
query = "SELECT skillid FROM skillmaster WHERE upper(skillDetails) IN (%s)"
|
11 |
+
params = (SkillName.upper(),) # Replace 'Test' with your actual variable or user input
|
12 |
cursor.execute(query, params)
|
13 |
+
if cursor.rowcount == 0:
|
14 |
+
|
15 |
+
skill_type = "Hard Skill"
|
16 |
+
skill_score1 = 0
|
17 |
+
weightage = 0
|
18 |
+
is_active = True
|
19 |
+
returnMsg = 'Skill Not in DB'
|
20 |
+
insert_query = ("""INSERT INTO skillmaster (SkillDetails, SkillType, Weightage, IsActive, skill_score)
|
21 |
+
VALUES (%s, %s, %s, %s, %s)""")
|
22 |
+
cursor.execute(insert_query, (SkillName, skill_type, weightage, is_active, skill_score1))
|
23 |
+
conn.commit()
|
24 |
+
returnMsg = 'Skill Added successfully'
|
25 |
+
else:
|
26 |
+
query = "update skillmaster set weightage = 0 where upper(skilldetails) = (%s)"
|
27 |
+
params = (SkillName.upper(),)
|
28 |
+
cursor.execute(query, params)
|
29 |
+
conn.commit()
|
30 |
+
returnMsg = 'Skill Updated successfully'
|
31 |
+
|
32 |
+
# Close the cursor and connection
|
33 |
cursor.close()
|
34 |
+
# Close the connection
|
35 |
+
conn.close()
|
36 |
+
print(returnMsg)
|
37 |
+
|
38 |
+
|
39 |
+
|
SkillExtractV1.py
CHANGED
@@ -106,7 +106,7 @@ class SkillExtractorDetailsV1:
|
|
106 |
def getSkills1():
|
107 |
conn = DbConnection.GetMySQLDbConnection()
|
108 |
cursor = conn.cursor()
|
109 |
-
cursor.execute("SELECT upper(skilldetails) skills FROM skillmaster")
|
110 |
cursor.close()
|
111 |
# Close the connection
|
112 |
conn.close()
|
|
|
106 |
def getSkills1():
|
107 |
conn = DbConnection.GetMySQLDbConnection()
|
108 |
cursor = conn.cursor()
|
109 |
+
cursor.execute("SELECT upper(skilldetails) skills FROM skillmaster where weightage = 0")
|
110 |
cursor.close()
|
111 |
# Close the connection
|
112 |
conn.close()
|