internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: GeotrekCE/Geotrek-admin

Issue:
Interventions - calcul des coûts
Dans le module intervention, il y a un truc que je comprends pas trop sur le calcul des coûts, en effet les coûts ne se cumulent pas, on dirait qu'il privilégie certains postes.
Par exemple si j'ajoute que la sous-traitance c'est bon : 
![image](https://user-images.githubusercontent.com/19687397/116561824-f297de80-a902-11eb-945f-7bcb3b79fb24.png)
 
Si je viens à ajouter du matériel en même temps, ça ne prend plus en compte la sous-traitance 
![image](https://user-images.githubusercontent.com/19687397/116562030-1e1ac900-a903-11eb-90ea-0de6c84ccf2d.png)

Et si j’ajoute tout, ça prend en compte que le coût matériel et homme 
![image](https://user-images.githubusercontent.com/19687397/116562916-e19b9d00-a903-11eb-9248-00ca11934e22.png)

Je peux comprendre la logique de départ en se disant c'est soit une intervention par un sous traitant ou soit une intervention interne, mais il peut y avoir des cas où il y a un coût matériel en plus d'une sous-traitance ou même une intervention d'un technicien. Du coup dans un soucis de compréhension et pour éviter des erreurs de suivi, est-ce que ce serait pas mieux de cumuler l'ensemble des coûts dans le coût total ?


Discussion:
Normalement le fonctionnement prévu est que le total est le total de tous les autres coûts.
Il y a donc bien un soucis.

Resolving patch:
diff --git a/geotrek/maintenance/models.py b/geotrek/maintenance/models.py
--- a/geotrek/maintenance/models.py
+++ b/geotrek/maintenance/models.py
@@ -179,9 +179,9 @@ def total_cost_mandays_verbose_name(cls):
     @property
     def total_cost(self):
         return self.total_cost_mandays + \
-            self.material_cost or 0 + \
-            self.heliport_cost or 0 + \
-            self.subcontract_cost or 0
+            (self.material_cost or 0) + \
+            (self.heliport_cost or 0) + \
+            (self.subcontract_cost or 0)
 
     @classproperty
     def total_cost_verbose_name(cls):


Test patch:
diff --git a/geotrek/maintenance/tests/test_intervention.py b/geotrek/maintenance/tests/test_intervention.py
--- a/geotrek/maintenance/tests/test_intervention.py
+++ b/geotrek/maintenance/tests/test_intervention.py
@@ -198,3 +198,12 @@ def test_infrastructure_display_shows_object_name(self):
         self.assertIn('signage-16.png', interv.target_display)
         name = interv.target.name
         self.assertIn(name, interv.target_display)
+
+    def test_total_cost(self):
+        interv = InfrastructureInterventionFactory.create(
+            material_cost=1,
+            heliport_cost=2,
+            subcontract_cost=4
+            # implicit 1 manday x 500 €
+        )
+        self.assertEqual(interv.total_cost, 507)
Repository: GeotrekCE/Geotrek-admin

Issue:
Service type - Published ?
There are fields `Published` and `Waiting for publication` in `TYPE OF SERVICE` table : 

![service-type](https://user-images.githubusercontent.com/4418840/30688392-4f6ba824-9ebe-11e7-8b2e-d23e8a1cc6b4.jpg)

These fields are useful in `Service` table but not in `Type of service` table. and they are not in `Service` table. They should be switched from a table to another I guess. 
Service type - Published ?
There are fields `Published` and `Waiting for publication` in `TYPE OF SERVICE` table : 

![service-type](https://user-images.githubusercontent.com/4418840/30688392-4f6ba824-9ebe-11e7-8b2e-d23e8a1cc6b4.jpg)

These fields are useful in `Service` table but not in `Type of service` table. and they are not in `Service` table. They should be switched from a table to another I guess. 


Discussion:

Resolving patch:
diff --git a/geotrek/trekking/migrations/0047_remove_servicetype_review.py b/geotrek/trekking/migrations/0047_remove_servicetype_review.py
new file mode 100644
--- /dev/null
+++ b/geotrek/trekking/migrations/0047_remove_servicetype_review.py
@@ -0,0 +1,17 @@
+# Generated by Django 3.2.20 on 2023-09-05 17:30
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('trekking', '0046_alter_weblink_category'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='servicetype',
+            name='review',
+        ),
+    ]
diff --git a/geotrek/trekking/models.py b/geotrek/trekking/models.py
--- a/geotrek/trekking/models.py
+++ b/geotrek/trekking/models.py
@@ -20,7 +20,8 @@
 from mapentity.serializers import plain_text
 
 from geotrek.authent.models import StructureRelated
-from geotrek.common.mixins.models import (GeotrekMapEntityMixin,
+from geotrek.common.mixins.models import (BasePublishableMixin,
+                                          GeotrekMapEntityMixin,
                                           OptionalPictogramMixin,
                                           PictogramMixin, PicturesMixin,
                                           PublishableMixin,
@@ -866,7 +867,9 @@ def __str__(self):
         return self.label
 
 
-class ServiceType(TimeStampedModelMixin, PictogramMixin, PublishableMixin):
+class ServiceType(TimeStampedModelMixin, PictogramMixin, BasePublishableMixin):
+    name = models.CharField(verbose_name=_("Name"), max_length=128,
+                            help_text=_("Public name (Change carefully)"))
     practices = models.ManyToManyField('Practice', related_name="services",
                                        blank=True,
                                        verbose_name=_("Practices"))


Test patch:
Repository: GeotrekCE/Geotrek-admin

Issue:
Bug : erreur 500 sur le filtre "portals" du endpoint outdoor_rating de l'API V2
Bug introduit dans la 2.102.2 vraisemblablement par [ce morceau de code](https://github.com/GeotrekCE/Geotrek-admin/pull/3926/files#diff-00000d16a4913719d8f17c97de4e19dd3e468f90ab3fb8adb0a2eb65d28d6c69).

Les parcours outdoor n'ont pas de portails donc la requête plante. Bug constaté sur plusieurs instances.

Correctif en cours de développement. J'aimerai juste confirmation de @Chatewgne pour bien comprendre pourquoi ce filtre avait été développé ?



Discussion:

Resolving patch:
diff --git a/geotrek/api/v2/filters.py b/geotrek/api/v2/filters.py
--- a/geotrek/api/v2/filters.py
+++ b/geotrek/api/v2/filters.py
@@ -1068,14 +1068,14 @@ def filter_queryset(self, request, qs, view):
         return self.filter_queryset_related_objects_published_by_portal(qs, request, 'sites')
 
 
-class CourseRelatedPortalFilter(RelatedObjectsPublishedNotDeletedFilter):
+class CourseRelatedFilter(RelatedObjectsPublishedNotDeletedFilter):
     def filter_queryset(self, request, qs, view):
         return self.filter_queryset_related_objects_published(qs, request, 'courses')
 
 
-class SitesAndCourseRelatedPortalFilter(RelatedObjectsPublishedNotDeletedByPortalFilter):
+class SitesRelatedPortalAndCourseRelatedFilter(RelatedObjectsPublishedNotDeletedByPortalFilter):
     def filter_queryset(self, request, qs, view):
-        set_1 = self.filter_queryset_related_objects_published_by_portal(qs, request, 'courses')
+        set_1 = self.filter_queryset_related_objects_published(qs, request, 'courses')
         set_2 = self.filter_queryset_related_objects_published_by_portal(qs, request, 'sites')
         return (set_1 | set_2).distinct()
 
diff --git a/geotrek/api/v2/views/outdoor.py b/geotrek/api/v2/views/outdoor.py
--- a/geotrek/api/v2/views/outdoor.py
+++ b/geotrek/api/v2/views/outdoor.py
@@ -58,7 +58,7 @@ class SiteTypeViewSet(api_viewsets.GeotrekGeometricViewset):
 
 class CourseTypeViewSet(api_viewsets.GeotrekGeometricViewset):
     filter_backends = api_viewsets.GeotrekGeometricViewset.filter_backends + (
-        api_filters.CourseRelatedPortalFilter,
+        api_filters.CourseRelatedFilter,
     )
     serializer_class = api_serializers.CourseTypeSerializer
     queryset = outdoor_models.CourseType.objects \
@@ -75,7 +75,7 @@ class OutdoorRatingScaleViewSet(api_viewsets.GeotrekViewSet):
 class OutdoorRatingViewSet(api_viewsets.GeotrekViewSet):
     filter_backends = api_viewsets.GeotrekViewSet.filter_backends + (
         api_filters.GeotrekRatingFilter,
-        api_filters.SitesAndCourseRelatedPortalFilter,
+        api_filters.SitesRelatedPortalAndCourseRelatedFilter
     )
     serializer_class = api_serializers.OutdoorRatingSerializer
     queryset = outdoor_models.Rating.objects \


Test patch:
Repository: GeotrekCE/Geotrek-admin

Issue:
Signalétiques : les lames supprimées apparaissent toujours dans la fiche détail d'une signalétique
**Comportement pour reproduire :**

- Créer une signalétique
- Créer une lame associée à cette signalétique
- Supprimer la lame qui vient d'être créée
- Se rendre sur la vue détail de la signalétique

**Comportement observé :**

- J'observe que la lame que je viens de supprimer est toujours présente dans la liste des lames

**Comportement normal**

- La lame ne devrait plus apparaître dans la liste des lames d'une signalétique à partir du moment où elle a été supprimée


Discussion:

Resolving patch:
diff --git a/geotrek/signage/models.py b/geotrek/signage/models.py
--- a/geotrek/signage/models.py
+++ b/geotrek/signage/models.py
@@ -137,7 +137,7 @@ def tourism_signages(cls, tourism_obj, queryset=None):
 
     @property
     def order_blades(self):
-        return self.blade_set.all().order_by(collate_c('number'))
+        return self.blade_set.existing().order_by(collate_c('number'))
 
     @property
     def coordinates(self):


Test patch:
Repository: GeotrekCE/Geotrek-admin

Issue:
Problème de thumbnail avec les SVG
Bug détecté à partir de la version 2.101.4 de Geotrek Admin.  

Celui est déclenché par l'ajout d'un SVG comme pictogramme sur un lieu de renseignement. 

Explication : la dernière version de easy_thumbnail n'accepte pas de faire le thumbnail d'un SVG. -> l'api V2 plante



Discussion:
Il faudrait utiliser la sous-dep [easy-thumbnails[svg]](https://github.com/SmileyChris/easy-thumbnails#breaking-news)

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -72,6 +72,7 @@ def run(self):
         # prod,
         'gunicorn',
         'sentry-sdk',
+        'easy-thumbnails[svg]',
     ],
     cmdclass={"build": BuildCommand},
     include_package_data=True,


Test patch:
diff --git a/geotrek/api/tests/test_v2.py b/geotrek/api/tests/test_v2.py
--- a/geotrek/api/tests/test_v2.py
+++ b/geotrek/api/tests/test_v2.py
@@ -2156,12 +2156,32 @@ def test_informationdesk_list(self):
             tourism_models.InformationDesk
         )
 
+    def test_informationdesk_list_with_svg(self):
+        info_desk = tourism_factory.InformationDeskFactory(
+            photo=get_dummy_uploaded_image_svg(), name='test!')
+        info_desk.save()
+        self.treks[0].information_desks.add(info_desk)
+        self.check_number_elems_response(
+            self.get_informationdesk_list(),
+            tourism_models.InformationDesk
+        )
+
     def test_informationdesk_detail(self):
         self.check_structure_response(
             self.get_informationdesk_detail(self.info_desk.pk),
             INFORMATION_DESK_PROPERTIES_JSON_STRUCTURE
         )
 
+    def test_informationdesk_detail_with_svg(self):
+        info_desk = tourism_factory.InformationDeskFactory(
+            photo=get_dummy_uploaded_image_svg())
+        info_desk.save()
+        self.treks[0].information_desks.add(info_desk)
+        self.check_structure_response(
+            self.get_informationdesk_detail(info_desk.pk),
+            INFORMATION_DESK_PROPERTIES_JSON_STRUCTURE
+        )
+
     def test_informationdesk_filter_trek(self):
         response = self.get_informationdesk_list({'trek': self.treks[0].pk})
         self.assertEqual(response.json()["count"], 1)
Repository: GeotrekCE/Geotrek-admin

Issue:
Traductions sur le "hover" des filtres
# Résumé

Dans l'interface, tout les filtres qui utilisent le widget `OneLineRangeWidget` ne sont pas traduit.

# Reproduction

- Passé geotrek admin en anglais
- Remplir certains filtres (ceux avec min / max)
- Fermer la fenêtre des filtres
- Placer la souris sur le bouton `Filter`

On pourra observer certains éléments traduits et d'autre non.


Discussion:

Resolving patch:
diff --git a/geotrek/common/filters/__init__.py b/geotrek/common/filters/__init__.py
--- a/geotrek/common/filters/__init__.py
+++ b/geotrek/common/filters/__init__.py
@@ -1,3 +1,4 @@
+from django.utils.text import format_lazy
 from django.utils.translation import gettext_lazy as _
 from django_filters import ModelMultipleChoiceFilter, RangeFilter
 from mapentity.filters import MapEntityFilterSet
@@ -15,8 +16,8 @@ class OptionalRangeFilter(RangeFilter):
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
-        self.field.fields[0].label = _('min %s') % self.field.label
-        self.field.fields[1].label = _('max %s') % self.field.label
+        self.field.fields[0].label = format_lazy('{min} {label}', min=_('min'), label=self.field.label)
+        self.field.fields[1].label = format_lazy('{max} {label}', max=_('max'), label=self.field.label)
 
 
 class RightFilter(ModelMultipleChoiceFilter):
diff --git a/geotrek/maintenance/filters.py b/geotrek/maintenance/filters.py
--- a/geotrek/maintenance/filters.py
+++ b/geotrek/maintenance/filters.py
@@ -2,6 +2,7 @@
 from django.conf import settings
 from django.contrib.gis.geos import GeometryCollection
 from django.utils.translation import gettext_lazy as _
+from django.utils.text import format_lazy
 from django_filters import ChoiceFilter, MultipleChoiceFilter, DateFromToRangeFilter, ModelMultipleChoiceFilter
 
 from mapentity.filters import PolygonFilter, PythonPolygonFilter
@@ -125,8 +126,8 @@ class AltimetryInterventionFilterSet(AltimetryPointFilterSet):
 class CustomDateFromToRangeFilter(DateFromToRangeFilter):
     def __init__(self, *args, **kwargs):
         super(DateFromToRangeFilter, self).__init__(*args, **kwargs)
-        self.field.fields[0].label = _('min %s') % self.field.label
-        self.field.fields[1].label = _('max %s') % self.field.label
+        self.field.fields[0].label = format_lazy('{min} {label}', min=_('min'), label=self.field.label)
+        self.field.fields[1].label = format_lazy('{max} {label}', max=_('max'), label=self.field.label)
 
 
 class InterventionFilterSet(AltimetryInterventionFilterSet, ZoningFilterSet, StructureRelatedFilterSet):


Test patch:
Repository: GeotrekCE/Geotrek-admin

Issue:
[Sensitivity module] Deleted zones are still present in the open-air export
A clause is missing to exclude deleted sensitive areas in OpenAir API queryset.

assigned to my self.
[Sensitivity module] Deleted zones are still present in the open-air export
A clause is missing to exclude deleted sensitive areas in OpenAir API queryset.

assigned to my self.


Discussion:

Resolving patch:
diff --git a/geotrek/sensitivity/views.py b/geotrek/sensitivity/views.py
--- a/geotrek/sensitivity/views.py
+++ b/geotrek/sensitivity/views.py
@@ -137,7 +137,7 @@ class SensitiveAreaOpenAirList(PublicOrReadPermMixin, ListView):
 
     def get_queryset(self):
         aerial_practice = SportPractice.objects.filter(name__in=settings.SENSITIVITY_OPENAIR_SPORT_PRACTICES)
-        return SensitiveArea.objects.filter(
+        return SensitiveArea.objects.existing().filter(
             species__practices__in=aerial_practice, published=True
         ).select_related('species')
 


Test patch:
Repository: cobbler/cobbler

Issue:
reposync fails if no yumopts present
Traceback

https://gist.github.com/goozbach/91650444e4ba3aa306c2

Simple patch forthcoming.



Discussion:
may be related to #218 or #550 


Resolving patch:
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -536,8 +536,9 @@ def create_local_file(self, dest_path, repo, output=True):
         config_file = open(fname, "w+")
         config_file.write("[%s]\n" % repo.name)
         config_file.write("name=%s\n" % repo.name)
-        config_file.write("exclude=%s\n" % repo.yumopts['exclude'])
-        self.logger.debug("excluding: %s" % repo.yumopts['exclude'])
+        if 'exclude' in repo.yumopts.keys():
+            config_file.write("exclude=%s\n" % repo.yumopts['exclude'])
+            self.logger.debug("excluding: %s" % repo.yumopts['exclude'])
         optenabled = False
         optgpgcheck = False
         if output:


Test patch:
Repository: cobbler/cobbler

Issue:
'get-loader' needs syslinux updating.
I've confirmed that the version of syslinux (3.61) currently in get-loader will not let you deploy vmware 5.1 on random machine. 

It errors with "fatal error: 10 (out of resources)" when loading tools.t00.

Using the pxelinux.0 and menu.c32 binaries from the syslinux-3.86.tar.gz build on kernel.org fixes it, and lets it work. 



Discussion:
menu.c32 and pxelinux.0 updated from syslinux 4.02

I think syslinux 4.02 is guaranteed to break EVERY vmware install, as they're stuck on the 3.x loaders (I jumped into IRC to chat to you about this, but couldn't remember your IRC nick. Sorry!)

If i replace the 4.02 stuff with 3.86, can you verify if ESX installations work again?
I need to expand my test env; i dont have any esx stuff yet. Any help is very much welcome!


Resolving patch:
diff --git a/cobbler/action_dlcontent.py b/cobbler/action_dlcontent.py
--- a/cobbler/action_dlcontent.py
+++ b/cobbler/action_dlcontent.py
@@ -56,8 +56,8 @@ def run(self,force=False):
           ( "%s/COPYING.syslinux" % content_server, "%s/COPYING.syslinux" % dest),
           ( "%s/elilo-3.8-ia64.efi" % content_server, "%s/elilo-ia64.efi" % dest ),
           ( "%s/yaboot-1.3.14-12" % content_server, "%s/yaboot" % dest),
-          ( "%s/pxelinux.0-4.02" % content_server, "%s/pxelinux.0" % dest),
-          ( "%s/menu.c32-4.02" % content_server, "%s/menu.c32" % dest),
+          ( "%s/pxelinux.0-3.86" % content_server, "%s/pxelinux.0" % dest),
+          ( "%s/menu.c32-3.86" % content_server, "%s/menu.c32" % dest),
           ( "%s/grub-0.97-x86.efi" % content_server, "%s/grub-x86.efi" % dest),
           ( "%s/grub-0.97-x86_64.efi" % content_server, "%s/grub-x86_64.efi" % dest),
        )


Test patch:
Repository: cobbler/cobbler

Issue:
koan provisioning of XEN guest fails on CentOS 5
When provisioning a XEN guest on CentOS 5 with koan 2.4.0 the command fails with the virt-install message:

```
koan --server=example.cobblerd.org --virt --system test
...
"ERROR    --extra-args only work if specified with --location."
command failed (1)
```

The virtinstall.py script from the koan package does NOT set the location argument appropriate when provisioning a XEN guest.

In order to get it working I've adjusted line number 217 of the virtinstall.py "elif is_qemu:" to "elif is_qemu **or is_xen**:".



Discussion:

Resolving patch:
diff --git a/koan/virtinstall.py b/koan/virtinstall.py
--- a/koan/virtinstall.py
+++ b/koan/virtinstall.py
@@ -214,7 +214,7 @@ def build_commandline(uri,
             # to the ISO.
             print "I want to make a floppy for %s" % kickstart
             floppy = utils.make_floppy(kickstart)
-    elif is_qemu:
+    elif is_qemu or is_xen:
         # images don't need to source this
         if not profile_data.has_key("install_tree"):
             raise koan.InfoException("Cannot find install source in kickstart file, aborting.")


Test patch:
Repository: cobbler/cobbler

Issue:
pxe files left in tfpboot when netboot is disabled
We've been using cobbler for some time and I've noticed that the pxe files are generated in the /tftpboot/pxe/grub and /tftpboot/pxe/pxelinux.cfg directories for systems regardless of whether or not netboot is enabled for a system. I'm assuming this hasn't been a problem for most people who are letting cobbler manage dhcp. I'm guessing the dhcp config is manipulated so once netboot is disabled, it removes the boot file from the config. We are using cobbler in a slightly unconventional way as it pertains to dhcp/pxe. We use the pxe files generated by cobbler, but they are accessed via a tfp/dhcp server that is not managed by cobbler. This is done because we have other systems getting managed outside of cobbler that also generate pxe configurations. 

I'm wondering if there is a reason these pxe files are not removed when the host has netboot disabled. 

As a test, I modified the code (this is 2.2.3-2) in /usr/lib/python2.6/site-packages/cobbler/pxegen.py line 279 and added (and system.netboot_enabled):

```
            os.symlink("../yaboot", f3)
        else:
            continue
```

> > ```
> >     if system.is_management_supported() and system.netboot_enabled:
> >             if not image_based:
> >                 self.write_pxe_file(f2, system, profile, distro, working_arch)
> >                 if grub_path:
> >                     self.write_pxe_file(grub_path, system, profile, distro,
> >                             working_arch, format="grub")
> >             else:
> >                 self.write_pxe_file(f2, system, None, None, working_arch, image=profile)
> >         else:
> >             # ensure the file doesn't exist
> >             utils.rmfile(f2)
> >             if grub_path:
> >                 utils.rmfile(grub_path)
> > ```

This change had the desired affect. Is this something that can be patched into the code, or am I missing something?



Discussion:
Seems valid reasoning to me.


Resolving patch:
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py
--- a/cobbler/pxegen.py
+++ b/cobbler/pxegen.py
@@ -282,7 +282,7 @@ def write_all_system_files(self, system):
             else:
                 continue 
 
-            if system.is_management_supported():
+            if system.is_management_supported() and system.netboot_enabled:
                 if not image_based:
                     self.write_pxe_file(f2, system, profile, distro, working_arch, metadata=pxe_metadata)
                     if grub_path:


Test patch:
Repository: cobbler/cobbler

Issue:
cobbler replicate does not replicate scripts directory
Script directory should be added to rsync.template and action_replicate.py



Discussion:

Resolving patch:
diff --git a/cobbler/action_replicate.py b/cobbler/action_replicate.py
--- a/cobbler/action_replicate.py
+++ b/cobbler/action_replicate.py
@@ -185,6 +185,8 @@ def replicate_data(self):
             self.rsync_it("cobbler-snippets","/var/lib/cobbler/snippets")
             self.logger.info("Rsyncing triggers")
             self.rsync_it("cobbler-triggers","/var/lib/cobbler/triggers")
+            self.logger.info("Rsyncing scripts")
+            self.rsync_it("cobbler-scripts","/var/lib/cobbler/scripts")
         else:
             self.logger.info("*NOT* Rsyncing Data")
 


Test patch: