<commit_before>extends ../layout
include ../includes/tabs
mixin inmate(item)
    div.inmateDetails(class=item.visited ? 'visited' : '')
        a.inmateBlock(href="/subject/#{item.prisonNumber}/summary#{queryStrings.thisPage}")
            span.inmateContainer
                span(class=item.visited ? '' : 'bold-medium').capitalise-text #{setCase.capital(item.firstName +' '+ (item.middleName)) +' '+ item.lastName +' '}
                if item.dob
                    span(class=item.visited ? '' : 'bold-medium') &middot; #{moment(item.dob).format('DD/MM/YYYY')}
                if item.isAlias
                    span.block Matched on alias: #{setCase.capital(item.aliasFirst + ' ' + item.aliasLast)}
                if item.prisonNumber
                    span.prisonNumber.block.text-secondary
                        | Prison no. #{item.prisonNumber}
                        if item.receptionDate
                            |  &bull; Reception #{moment(item.receptionDate).format('DD/MM/YYYY')}

            form(method="post" action="/search/addToShortlist")
                input(type="hidden" name="_csrf" value="#{csrfToken}")
                input(type="hidden" name="addToShortList" value="#{item.prisonNumber}")
                - var middleName = item.middleName ? item.middleName + ' ' : ''
                - var fullName = setCase.capital(item.firstName + ' ' + middleName + item.lastName)
                input(type="hidden" name="addToShortListName" value="#{!item.shortListed ? fullName+' added to' : fullName+' removed from'}")

                if comparisonEnabled && data.length > 1
                    if item.shortListed
                        input(type="submit" value="Remove from shortlist" class="link" id="addToShortlist")
                    else if !shortList || shortList.prisonNumbers.length < 3
                        input(type="submit" value="Add to shortlist" class="link" id="addToShortlist")
                    else
                        input(type="submit" value="Shortlist full - compare #{shortList.prisonNumbers.length} prisoners" class="link" id="addToShortlist" name="viewShortlist")

        block

block content
    div.grid-row

        if comparisonEnabled && shortList && shortList.prisonNumbers.length > 0
            div.column-full
                div#notice.c-align
                    if shortList.latestName
                        |#{shortList.latestName} the shortlist.&nbsp;
                    else
                        |Prisoner added to the shortlist.&nbsp;
                    if shortList.prisonNumbers.length === 1
                        |Add further prisoners to compare
                    else
                        a(href="#{shortList.href}#{queryStrings.thisPage}") Compare #{shortList.prisonNumbers.length} prisoners
<commit_msg>Allow adding to shortlist when only one result<commit_after>extends ../layout
include ../includes/tabs
mixin inmate(item)
    div.inmateDetails(class=item.visited ? 'visited' : '')
        a.inmateBlock(href="/subject/#{item.prisonNumber}/summary#{queryStrings.thisPage}")
            span.inmateContainer
                span(class=item.visited ? '' : 'bold-medium').capitalise-text #{setCase.capital(item.firstName +' '+ (item.middleName)) +' '+ item.lastName +' '}
                if item.dob
                    span(class=item.visited ? '' : 'bold-medium') &middot; #{moment(item.dob).format('DD/MM/YYYY')}
                if item.isAlias
                    span.block Matched on alias: #{setCase.capital(item.aliasFirst + ' ' + item.aliasLast)}
                if item.prisonNumber
                    span.prisonNumber.block.text-secondary
                        | Prison no. #{item.prisonNumber}
                        if item.receptionDate
                            |  &bull; Reception #{moment(item.receptionDate).format('DD/MM/YYYY')}

            form(method="post" action="/search/addToShortlist")
                input(type="hidden" name="_csrf" value="#{csrfToken}")
                input(type="hidden" name="addToShortList" value="#{item.prisonNumber}")
                - var middleName = item.middleName ? item.middleName + ' ' : ''
                - var fullName = setCase.capital(item.firstName + ' ' + middleName + item.lastName)
                input(type="hidden" name="addToShortListName" value="#{!item.shortListed ? fullName+' added to' : fullName+' removed from'}")

                if comparisonEnabled && data.length >= 1
                    if item.shortListed
                        input(type="submit" value="Remove from shortlist" class="link" id="addToShortlist")
                    else if !shortList || shortList.prisonNumbers.length < 3
                        input(type="submit" value="Add to shortlist" class="link" id="addToShortlist")
                    else
                        input(type="submit" value="Shortlist full - compare #{shortList.prisonNumbers.length} prisoners" class="link" id="addToShortlist" name="viewShortlist")

        block

block content
    div.grid-row

        if comparisonEnabled && shortList && shortList.prisonNumbers.length > 0
            div.column-full
                div#notice.c-align
                    if shortList.latestName
                        |#{shortList.latestName} the shortlist.&nbsp;
                    else
                        |Prisoner added to the shortlist.&nbsp;
                    if shortList.prisonNumbers.length === 1
                        |Add further prisoners to compare
                    else
                        a(href="#{shortList.href}#{queryStrings.thisPage}") Compare #{shortList.prisonNumbers.length} prisoners

{'fraction_non_alphanumeric': 0.12199858757062147, 'fraction_numerical': 0.0014124293785310734, 'mean_word_length': 1.9413291796469367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2452213', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1444, 'n_words': 275}