Fix the edit form so Save persists stage changes
Changing an application's stage and pressing Save closed the form without saving the stage: JobsDatabase::updateJob() deliberately skips the stage column so every move lands in stage_history, but JobEditModel::save() never followed up with setStage(). It now does, as the CLI's update command always has. Also: - Validate that company and title are non-empty and say so, instead of saving a blank field - Always set lastError on failure, clear it on the next attempt, and bind the page's error message to it - Reload the form's values when jobsModel is assigned, since QML does not guarantee it is set before editingJobId - Bind the salary spin boxes to the model and write back only on user edits; guard the notes field the same way - Add jobeditmodeltest covering load order, edits, stage history, salaries round-tripping, adding, and validation errors Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BxDf7HqD1xPnsZP8wt3NTk
This commit is contained in:
@@ -39,3 +39,25 @@ target_link_libraries(sankeylayouttest PRIVATE
|
||||
)
|
||||
|
||||
add_test(NAME sankeylayouttest COMMAND sankeylayouttest)
|
||||
|
||||
add_executable(jobeditmodeltest
|
||||
jobeditmodeltest.cpp
|
||||
../src/jobstage.cpp
|
||||
../src/jobsdatabase.cpp
|
||||
../src/jobsmodel.cpp
|
||||
../src/jobeditmodel.cpp
|
||||
../src/jobfieldcatalog.cpp
|
||||
)
|
||||
|
||||
target_include_directories(jobeditmodeltest PRIVATE ../src)
|
||||
|
||||
target_link_libraries(jobeditmodeltest PRIVATE
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Qml
|
||||
Qt6::Sql
|
||||
Qt6::Test
|
||||
KF6::I18n
|
||||
)
|
||||
|
||||
add_test(NAME jobeditmodeltest COMMAND jobeditmodeltest)
|
||||
|
||||
Reference in New Issue
Block a user