mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
fix(server/modules/createJob): job grades not inserting
The queries assume that the parsed grades are numerically indexed. But removing ipairs method, and using pairs method, allows to loop grades that are indexed with strings as well. Just like we are using pairs method inside generatenewJobTable
This commit is contained in:
@@ -72,10 +72,10 @@ function ESX.CreateJob(name, label, grades)
|
||||
{ query = 'INSERT INTO jobs (name, label) VALUES (?, ?)', values = { name, label } }
|
||||
}
|
||||
|
||||
for _, grade in ipairs(grades) do
|
||||
for _, grade in pairs(grades) do
|
||||
queries[#queries + 1] = {
|
||||
query = 'INSERT INTO job_grades (job_name, grade, name, label, salary, skin_male, skin_female) VALUES (?, ?, ?, ?, ?, ?, ?)',
|
||||
values = { name, grade.grade, grade.name, grade.label, grade.salary, '{}', '{}' }
|
||||
values = { name, grade.grade, grade.name, grade.label, grade.salary, json.encode(grade.skin_male) or '{}', json.encode(grade.skin_female) or '{}' }
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user