Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon committed Aug 18, 2023
1 parent 5c89266 commit 1d48608
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions landingzones/static/landingzones/js/landingzones.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var isSuperuser = false;
*****************************/
var updateZoneStatus = function() {
window.zoneStatusUpdated = false;
var zoneUuids = '';
var zoneUuids = [];

$('.sodar-lz-zone-tr-existing').each(function() {
var trId = $(this).attr('id');
Expand All @@ -15,7 +15,7 @@ var updateZoneStatus = function() {
var statusTd = zoneTr.find('td#sodar-lz-zone-status-' + zoneUuid);

if (statusTd.text() !== 'MOVED' && statusTd.text() !== 'DELETED') {
zoneUuids += zoneUuid + ',';
zoneUuids.push(zoneUuid);
}
});

Expand Down
2 changes: 1 addition & 1 deletion landingzones/tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setUp(self):
config_data={},
)
# Data for post requests
self.post_data = {'zone_uuids': str(self.landing_zone.sodar_uuid) + ','}
self.post_data = {'zone_uuids': [str(self.landing_zone.sodar_uuid)]}


class TestLandingZonePermissions(TestLandingZonePermissionsBase):
Expand Down
4 changes: 2 additions & 2 deletions landingzones/tests/test_views_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_post(self):
'landingzones:ajax_status',
kwargs={'project': self.project.sodar_uuid},
),
data={'zone_uuids': str(self.landing_zone.sodar_uuid) + ','},
data={'zone_uuids[]': [str(self.landing_zone.sodar_uuid)]},
)
self.assertEqual(response.status_code, 200)
expected = {
Expand All @@ -35,7 +35,7 @@ def test_post_no_zone(self):
'landingzones:ajax_status',
kwargs={'project': self.project.sodar_uuid},
),
data={'zone_uuids': ''},
data={'zone_uuids[]': []},
)
self.assertEqual(response.status_code, 200)
self.assertEquals(response.data, {})
3 changes: 1 addition & 2 deletions landingzones/views_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def check_zone_permission(self, zone, user):
return user.has_perm(permission, obj=zone.project)

def post(self, request, *args, **kwargs):
zone_uuids_string = request.data.get('zone_uuids')
zone_uuids = zone_uuids_string.split(',')[:-1]
zone_uuids = request.data.getlist('zone_uuids[]')
project = self.get_project()

# Filter landing zones based on UUIDs and project
Expand Down

0 comments on commit 1d48608

Please sign in to comment.