<commit_before>package org.bbop.apollo

import grails.transaction.Transactional
import org.hibernate.Hibernate
import org.hibernate.Session

@Transactional
class OrganismService {
    def featureService

    def deleteAllFeaturesForOrganism(Organism organism) {

        // the very slow way

        int count = 0
        //final Session session = sessionFactory.currentSession

        def list=Feature.withCriteria() {
            featureLocations {
                sequence {
                    eq("organism",organism)
                }
            }
        }


        def uniqueNames=list.collect {
            it.uniqueName
        }



        list.each {
            it.delete();
        }


        def events=FeatureEvent.withCriteria() {
            'in'("uniqueName",uniqueNames)
        }


        events.each {
            it.delete()
        }


        organism.save(flush: true )
        return count
    }
}<commit_msg>Remove some old comments and fix feature count returned from deleteAllFeaturesForOrganism<commit_after>package org.bbop.apollo

import grails.transaction.Transactional
import org.hibernate.Hibernate
import org.hibernate.Session

@Transactional
class OrganismService {
    def featureService

    def deleteAllFeaturesForOrganism(Organism organism) {
        def list=Feature.withCriteria() {
            featureLocations {
                sequence {
                    eq("organism",organism)
                }
            }
        }


        def uniqueNames=list.collect {
            it.uniqueName
        }

        list.each {
            it.delete();
        }


        def events=FeatureEvent.withCriteria() {
            'in'("uniqueName",uniqueNames)
        }


        events.each {
            it.delete()
        }


        organism.save(flush: true )
        return list.size()
    }
}
{'fraction_non_alphanumeric': 0.07917570498915401, 'fraction_numerical': 0.0005422993492407809, 'mean_word_length': 1.681686046511628, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1215222', 'n_tokens_mistral': 504, 'n_tokens_neox': 458, 'n_words': 91}