Skip to content

Commit

Permalink
App Datenmanagement: Bereinigungsarbeiten im Code
Browse files Browse the repository at this point in the history
  • Loading branch information
gdmhrogut committed Sep 19, 2023
1 parent e5c3848 commit 586be8e
Show file tree
Hide file tree
Showing 48 changed files with 1,071 additions and 1,071 deletions.
2 changes: 1 addition & 1 deletion accounts/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import binascii
import os

import binascii
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import User
Expand Down
26 changes: 13 additions & 13 deletions bemas/static/bemas/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
*
* @param {Object} field - single field
*
* inserts a deletion button for the given single field within an array field complex
* inserts a deletion button for the passed single field within an array field complex
*/
function addDeleteFieldButton(field) {
// create button
let deleteFieldButton = $('<button class="input-reset btn btn-warning" title="Wert löschen"><i class="fas fa-trash"></i></button></div>');
// insert created button after given single field
// insert created button after passed single field
deleteFieldButton.insertAfter(field);
// on clicking the created button...
deleteFieldButton.click(function () {
// delete given single field and the button itself
// delete passed single field and the button itself
field.parent().remove();
});
}
Expand All @@ -27,16 +27,16 @@ function addDeleteFieldButton(field) {
*
* @param {Object} field - field
*
* inserts a button after the given field for emptying the field
* inserts a button after the passed field for emptying the field
*/
function addEmptyFieldButton(field) {
// create button
let emptyFieldButton = $('<span><i class="clear-field fas fa-circle-minus text-primary" title="alle Selektionen entfernen"></i></span>');
// insert created button after given field
// insert created button after passed field
emptyFieldButton.insertAfter(field);
// on clicking the created button...
emptyFieldButton.click(function () {
// empty given field
// empty passed field
field.val([]);
});
}
Expand All @@ -46,17 +46,17 @@ function addEmptyFieldButton(field) {
* @name addField
*
* @param {Object} field - single field
* @param {Object} fieldToInsertAfter - field after which the given single field (i.e. its wrapper) shall be inserted
* @param {Object} fieldToInsertAfter - field after which the passed single field (i.e. its wrapper) shall be inserted
* @param {boolean} [buttonsPosition=false] - dynamically set vertical positions of buttons?
*
* inserts the given single field into an array field complex
* inserts the passed single field into an array field complex
*/
function addField(field, fieldToInsertAfter, buttonsPosition= false) {
// create wrapper
let wrapper = $('<div/>', { class: 'input-group', style: 'margin-top:0.5rem' });
// insert given single field into created wrapper
// insert passed single field into created wrapper
wrapper.append(field);
// insert created wrapper after given field after which the wrapper shall be inserted
// insert created wrapper after passed field after which the wrapper shall be inserted
wrapper.insertAfter(fieldToInsertAfter.parent().is('.input-group') ? fieldToInsertAfter.parent() : fieldToInsertAfter);
// add a deletion button
addDeleteFieldButton(field);
Expand All @@ -69,9 +69,9 @@ function addField(field, fieldToInsertAfter, buttonsPosition= false) {
* @function
* @name adoptReverseSearchResult
*
* @param {JSON} geoJson - results of search for objects within a certain radius around given coordinates
* @param {JSON} geoJson - results of search for objects within a certain radius around passed coordinates
*
* adopts results of search for objects within a certain radius around given coordinates
* adopts results of search for objects within a certain radius around passed coordinates
*/
function adoptReverseSearchResult(geoJson) {
let erfolg = false;
Expand Down Expand Up @@ -102,7 +102,7 @@ function adoptReverseSearchResult(geoJson) {
* @param {string} id - base text for HTML attribute id of field
* @param {string} name - base text for HTML attribute name of field
*
* cleans the given single field within an array field complex
* cleans the passed single field within an array field complex
*/
function cleanField(field, i, id, name) {
field.attr('id', id + '_' + i);
Expand Down
14 changes: 7 additions & 7 deletions bemas/static/bemas/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @function
* @name applyFilters
*
* applies filters for given model based on given filter objects list
* applies filters for passed model based on passed filter objects list
*
* @param {string} model - model
* @param {Object[]} filterObjectsList - filter objects list
Expand Down Expand Up @@ -33,7 +33,7 @@ function applyFilters(model, filterObjectsList) {
* @function
* @name createFilterObject
*
* creates a filter object based on given name, type and value
* creates a filter object based on passed name, type and value, and returns it
*
* @param {string} name - name
* @param {string} type - type
Expand Down Expand Up @@ -77,7 +77,7 @@ async function fetchGeoJsonFeatureCollection(url, lastCall=false) {
* @function
* @name filterApplication
*
* applies filters for given model
* applies filters for passed model
*
* @param {string} model - model
*/
Expand Down Expand Up @@ -122,7 +122,7 @@ function filterApplication(model) {
* @function
* @name filterGeoJsonFeatures
*
* filters GeoJSON features based on given filter objects list
* filters GeoJSON features based on passed filter objects list
*
* @param {string} model - model
* @param {Object[]} filterObjectsList - filter objects list
Expand Down Expand Up @@ -189,7 +189,7 @@ function filterGeoJsonFeatures(model, filterObjectsList, layer, isSubLayer, clus
* @function
* @name filterReset
*
* resets filters for given model
* resets filters for passed model
*
* @param {string} model - model
*/
Expand Down Expand Up @@ -259,7 +259,7 @@ function setGeoJsonFeaturePropertiesAndActions(feature, layer) {
* @function
* @name showAllGeoJsonFeatures
*
* shows all GeoJSON features of given model
* shows all GeoJSON features of passed model
*
* @param {string} model - model
*/
Expand Down Expand Up @@ -287,7 +287,7 @@ function showAllGeoJsonFeatures(model) {
* @function
* @name updateCurrentlyFilteredDataVariables
*
* update variables of currently filtered data for given model based on given GeoJSON map layer
* update variables of currently filtered data for passed model based on passed GeoJSON map layer
*
* @param {string} model - model
* @param {Object} layer - GeoJSON map layer
Expand Down
18 changes: 9 additions & 9 deletions bemas/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
@register.filter
def beautify_model_string(model_name):
"""
checks if given field is a geometry related field
checks if passed field is a geometry related field
:param model_name: model name
:return: given field is a geometry related field?
:return: passed field is a geometry related field?
"""
icon = '<i class="fas fa-{}"></i>'.format(get_icon_from_settings(model_name.lower()))
model = apps.get_app_config('bemas').get_model(model_name)
Expand All @@ -24,11 +24,11 @@ def beautify_model_string(model_name):
@register.filter
def get_dict_value_by_key(arg_dict, key):
"""
returns value of given key in given dictionary
returns value of passed key in passed dictionary
:param arg_dict: dictionary
:param key: key in dictionary
:return: value of given key in given dictionary
:return: value of passed key in passed dictionary
"""
return arg_dict.get(key)

Expand All @@ -37,21 +37,21 @@ def get_dict_value_by_key(arg_dict, key):
@stringfilter
def get_icon(key):
"""
returns icon (i.e. value) of given key in icon dictionary
returns icon (i.e. value) of passed key in icon dictionary
:param key: key in icon dictionary
:return: icon (i.e. value) of given key in icon dictionary
:return: icon (i.e. value) of passed key in icon dictionary
"""
return get_icon_from_settings(key)


@register.filter
def is_field_geometry_field(field):
"""
checks if given field is a geometry related field
checks if passed field is a geometry related field
:param field: field
:return: given field is a geometry related field?
:return: passed field is a geometry related field?
"""
return is_geometry_field(field.field.__class__)

Expand All @@ -60,7 +60,7 @@ def is_field_geometry_field(field):
@stringfilter
def replace(value, arg):
"""
replaces string in given value
replaces string in passed value
:param value: value
:param arg: source string and target string
Expand Down
4 changes: 2 additions & 2 deletions bemas/templates/bemas/generic-objectclass-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h2><i class="fas fa-{{ objectclass_name|lower|get_icon }}"></i> <em>{{ objectcl
* @function
* @name mapCallbackFunction
*
* handles (as a callback function) given map
* handles (as a callback function) passed map
*
* @param {Object} map - map
*/
Expand Down Expand Up @@ -239,7 +239,7 @@ <h2><i class="fas fa-{{ objectclass_name|lower|get_icon }}"></i> <em>{{ objectcl
});
});

// handle sector select field: add tooltips to options, based on examples given for sectors
// handle sector select field: add tooltips to options, based on examples passed for sectors
let sectorExamples = [];
{% if sector_examples %}
sectorExamples = {{ sector_examples|safe }}
Expand Down
2 changes: 1 addition & 1 deletion bemas/templates/bemas/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ <h2 id="heading-address-search" class="accordion-header">
* @function
* @name mapCallbackFunction
*
* handles (as a callback function) given map
* handles (as a callback function) passed map
*
* @param {Object} map - map
*/
Expand Down
16 changes: 8 additions & 8 deletions bemas/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def init(self):

def generic_existance_test(self, test_object):
"""
tests general existance of given test object
tests general existance of passed test object
:param self
:param test_object: test object
Expand All @@ -56,7 +56,7 @@ def generic_existance_test(self, test_object):

def generic_create_test(self):
"""
tests creation of test object of given model
tests creation of test object of passed model
:param self
"""
Expand All @@ -71,7 +71,7 @@ def generic_create_test(self):

def generic_update_test(self):
"""
tests update of test object of given model
tests update of test object of passed model
:param self
"""
Expand All @@ -89,7 +89,7 @@ def generic_update_test(self):

def generic_delete_test(self):
"""
tests deletion of test object of given model
tests deletion of test object of passed model
:param self
"""
Expand Down Expand Up @@ -131,7 +131,7 @@ def generic_crud_view_test(self, update_mode, bemas_user, bemas_admin, view_name
response = self.client.post(url, data)
# status code of response as expected?
self.assertEqual(response.status_code, status_code)
# content type of response
# content type of response as expected?
self.assertEqual(response['content-type'].lower(), content_type)
# clean object filter
object_filter = clean_object_filter(object_filter, self.model)
Expand Down Expand Up @@ -189,7 +189,7 @@ def init(self):

def generic_existance_test(self, test_object_from, test_object_to, relationship):
"""
tests general existance of many-to-many-relationship of given test objects
tests general existance of many-to-many-relationship of passed test objects
:param self
:param test_object_from: test object (from)
Expand All @@ -205,7 +205,7 @@ def generic_existance_test(self, test_object_from, test_object_to, relationship)

def generic_create_test(self):
"""
tests creation of many-to-many-relationship of test objects of given models
tests creation of many-to-many-relationship of test objects of passed models
:param self
"""
Expand All @@ -223,7 +223,7 @@ def generic_create_test(self):

def generic_delete_test(self):
"""
tests deletion of many-to-many-relationship of test objects of given models
tests deletion of many-to-many-relationship of test objects of passed models
:param self
"""
Expand Down
8 changes: 4 additions & 4 deletions bemas/tests/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

def clean_object_filter(object_filter, model=None):
"""
cleans given object filter and returns it
cleans passed object filter and returns it
:param object_filter: object filter
:param model: model
:return: cleaned version of given object filter
:return: cleaned version of passed object filter
"""
cleaned_object_filter = object_filter.copy()
# remove geometry field from object filter
Expand All @@ -19,11 +19,11 @@ def clean_object_filter(object_filter, model=None):

def get_object(model, object_filter):
"""
fetches object of given model from the database according to given object filter and returns it
fetches object of passed model from the database according to passed object filter and returns it
:param model: model
:param object_filter: object filter
:return: object of given model from the database according to given object filter
:return: object of passed model from the database according to passed object filter
"""
return model.objects.get(**object_filter)

Expand Down
Loading

0 comments on commit 586be8e

Please sign in to comment.