Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace map_employees with export settings #708

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions apps/workspaces/apis/map_employees/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,16 @@ def update(self, instance, validated_data):

workspace_general_settings_instance = WorkspaceGeneralSettings.objects.filter(workspace_id=instance.id).first()

if workspace_general_settings_instance and (workspace_general_settings_instance.employee_field_mapping != workspace_general_settings['employee_field_mapping']):
workspace_general_settings_instance.reimbursable_expenses_object = None
workspace_general_settings_instance.save()

workspace_general_settings_instance, _ = WorkspaceGeneralSettings.objects.update_or_create(
workspace_id=workspace_id, defaults={'employee_field_mapping': workspace_general_settings['employee_field_mapping'], 'auto_map_employees': workspace_general_settings['auto_map_employees']}
workspace_id=workspace_id,
defaults={
'employee_field_mapping': workspace_general_settings['employee_field_mapping'],
'auto_map_employees': workspace_general_settings['auto_map_employees']
}
)

MapEmployeesTriggers.run_workspace_general_settings_triggers(workspace_general_settings_instance)

if instance.onboarding_state == 'MAP_EMPLOYEES':
instance.onboarding_state = 'EXPORT_SETTINGS'
instance.save()

return instance

def validate(self, data):
Expand Down
2 changes: 1 addition & 1 deletion sql/functions/e2e-test-setup-workspace-local.sql
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ BEGIN
-- RAISE NOTICE 'Deleted % workspaces', rcount;

UPDATE workspaces
SET onboarding_state = 'MAP_EMPLOYEES', last_synced_at = null
SET onboarding_state = 'EXPORT_SETTINGS', last_synced_at = null
WHERE id = _workspace_id;

UPDATE last_export_details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def test_map_employees(api_client, test_connection):

workspace = Workspace.objects.get(id=3)
workspace.onboarding_state = 'MAP_EMPLOYEES'
workspace.onboarding_state = 'EXPORT_SETTINGS'
anishfyle marked this conversation as resolved.
Show resolved Hide resolved
workspace.save()

workspace_general_settings_instance = WorkspaceGeneralSettings.objects.filter(workspace_id=3).first()
Expand Down
Loading