Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feature/issue3169
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Jan 9, 2025
2 parents 2ab42a1 + 623f3d5 commit 3d279b9
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 19 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ jobs:
- name: Run javascript unit tests
run: node_modules/karma/bin/karma start karma.conf.js --single-run --browsers ChromeHeadless

# - name: Run MERIT functional tests
# run: ./src/main/scripts/runFunctionalTests.sh
# env:
# GPR_USER: ${{env.GITHUB_ACTOR}}
# GPR_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Run MERIT functional tests
run: ./src/main/scripts/runFunctionalTests.sh
env:
GPR_USER: ${{env.GITHUB_ACTOR}}
GPR_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Clean to remove clover instrumentation
uses: gradle/[email protected]
Expand Down
6 changes: 3 additions & 3 deletions grails-app/assets/javascripts/organisation.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ OrganisationViewModel = function (props, options) {
self.transients = self.transients || {};

function toTitleCase(name) {
return name.replace(/\S+/g, function(word) {
return name.replace(/\S+/g, function(word, offset) {
if (!word) {
return word;
}
word = word.toLowerCase();
var joiningWords = ['and', 'of', 'the', 'in', 'for', 'to', 'a', 'an', 'on', 'at', 'by', 'with', 'from', 'as', 'but', 'or', 'nor'];
if (joiningWords.indexOf(word) >= 0) {
if (offset && joiningWords.indexOf(word) >= 0) {
return word;
}
return word.charAt(0).toUpperCase() + word.substring(1)
return word.charAt(0).toUpperCase() + word.substring(1);
});
}
self.prepopulateFromABN = function() {
Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/shared/_sites.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
var facetsUsed = false;
<g:if test="${params.fq}">
<g:set var="fqList" value="${[params.fq].flatten()}"/>
url += "&fq=${fqList.collect{it.encodeAsURL()}.join('&fq=')}";
url += "&fq=${raw(fqList.collect{it.encodeAsURL()}.join('&fq='))}";
facetsUsed = true;
</g:if>
<g:if test="${params.fromDate}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CreateOrEditOrganisationSpec extends StubbedCasSpec {
openAboutTab()

then:
orgName.text() == "THE TRUSTEE FOR PSS FUND Test"
orgName.text() == "The Trustee for Pss Fund Test"
waitFor {orgDescription.displayed }
orgDescription.text() == "Test Organisation Description test"
waitFor {orgAbn.displayed }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class ProjectExplorerMapTabSpec extends StubbedCasSpec {
useDataSet("dataset_project_sites")
}

@Ignore
// Temporarily ignoring this test as it seems that google maps is not loading
void "The project explorer displays a list of projects"() {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{

"priority": 1,
"request": {
"urlPath": "/userdetails/userDetails/getUserDetails",
"method": "ANY",
"queryParameters": {
"userName": {
"equalTo": "jwtId"
}
}
},
"response": {
"transformers": ["response-template"],
"status": 404
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"priority": 3,
"request": {
"urlPath": "/userdetails/userDetails/userDetails/getUserDetails",
"method": "ANY"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"priority": 2,
"request": {
"urlPath": "/userdetails/userDetails/userDetails/getUserDetails",
"method": "ANY",
"queryParameters": {
"userName": {
"equalTo": "jwtId"
}
}
},
"response": {
"transformers": ["response-template"],
"status": 404,
"headers": {
"Content-Type": "application/json"
},
"body": null
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"priority": 4,
"request": {
"urlPath": "/userdetails/userDetails/getUserDetails",
"method": "ANY"
Expand Down
23 changes: 16 additions & 7 deletions src/main/groovy/au/org/ala/merit/GmsMapper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GmsMapper {
static final REPORTING_THEME_COLUMN = 'PGAT_PRIORITY'

static final FINANCIAL_YEAR_FUNDING_PREFIX = 'FUNDING_'

static final FINANCIAL_YEAR_FUNDING_DESCRIPTION = "FINANCIAL_YEAR_FUNDING_DESCRIPTION"
static MERIT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")

static final GMS_DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy")
Expand Down Expand Up @@ -95,10 +95,10 @@ class GmsMapper {

def geographicInfoMapping = [
NATIONWIDE:[name:'nationwide', type:'boolean', description:'If true, this project does not have a primary state'],
PRIMARY_STATE:[name:'primaryState', type:'string', description:''],
PRIMARY_ELECTORATE:[name:'primaryElectorate', type:'string', description:''],
OTHER_ELECTORATES:[name:'otherElectorates', type:'list', description:''],
OTHER_STATES:[name:'otherStates', type:'list', description:'']
PRIMARY_STATE:[name:'primaryState', type:'string', description:'The primary state to be manually assigned to this project'],
PRIMARY_ELECTORATE:[name:'primaryElectorate', type:'string', description:'The primary electorate to be manually assigned to this project'],
OTHER_ELECTORATES:[name:'otherElectorates', type:'list', description:'Other electorates to be manually assigned to this project. Enter as a comma separated list'],
OTHER_STATES:[name:'otherStates', type:'list', description:'Other states to be manually assigned to this project. Enter as a comma separated list'],
]


Expand Down Expand Up @@ -164,7 +164,7 @@ class GmsMapper {
List descriptions = []
List mandatoryFlags = []
List headers = []
projectMapping.each { String key, Map value ->
(projectMapping + geographicInfoMapping).each { String key, Map value ->
// Deliberately omit fields without a description as they are largely deprecated.
String description = value.description
if (description) {
Expand All @@ -176,6 +176,15 @@ class GmsMapper {
descriptions << description
}
}
// Special case for MERI plan funding mapping
headers << FINANCIAL_YEAR_FUNDING_DESCRIPTION
descriptions << "Description of the funding for each financial year. Must be present for financial year funding amounts to be imported"

for (int i : (18..30)) {
headers << FINANCIAL_YEAR_FUNDING_PREFIX+i+"_"+(i+1)
descriptions << "Funding amount for the financial year ${i} to ${i+1}"
}

csvWriter.writeNext(descriptions as String[])
csvWriter.writeNext(mandatoryFlags as String[])
csvWriter.writeNext(headers as String[])
Expand All @@ -190,7 +199,7 @@ class GmsMapper {
mappingKeys.add(DATA_SUB_TYPE_COLUMN)
mappingKeys.add(REPORTING_THEME_COLUMN)
mappingKeys.add(FINANCIAL_YEAR_FUNDING_PREFIX)
mappingKeys.add("FINANCIAL_YEAR_FUNDING_DESCRIPTION")
mappingKeys.add(FINANCIAL_YEAR_FUNDING_DESCRIPTION)

projectRows[0].keySet().each { key ->
if (!key?.trim() || key == 'index') {
Expand Down
3 changes: 2 additions & 1 deletion src/test/groovy/au/org/ala/merit/GmsMapperSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,9 @@ class GmsMapperSpec extends Specification{

then: "We are just checking every value in the spreadsheet is mappable and has a description"
lines.size() == 4
Map mappings = gmsMapper.projectMapping + gmsMapper.geographicInfoMapping
lines[3].every {String value ->
gmsMapper.projectMapping[value].description != null
value == GmsMapper.FINANCIAL_YEAR_FUNDING_DESCRIPTION || value.startsWith(GmsMapper.FINANCIAL_YEAR_FUNDING_PREFIX) || mappings[value].description != null
}
}

Expand Down
33 changes: 33 additions & 0 deletions src/test/js/spec/OrganisationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,37 @@ describe("OrganisationViewModel Spec", function () {

});

it("Can tidy the case of the org entity name", function() {
var options = {organisationSaveUrl:'/test/url', healthCheckUrl:'/test/health'};
var org = { name: '', organisationId:"org1" };
var model = new OrganisationPageViewModel(org, options);

var inputOutput = [
["TEST ALL CAPS", "Test All Caps"],
["THE TEST FOR FIRST JOINING WORD", "The Test for First Joining Word"],
["Another test", "Another Test"],
["Already Correct", "Already Correct"]
];

let result = {
entityName:''
};

spyOn($, 'get').and.callFake(function () {
var d = $.Deferred();
// resolve using our mock data
d.resolve(result);
return d.promise();
});

for (var i=0; i<inputOutput.length; i++) {
model.name(''); // The name won't be overwritten if already set.
result.entityName = inputOutput[i][0];
model.prepopulateFromABN();


expect(model.name()).toEqual(inputOutput[i][1]);
}
});

});

0 comments on commit 3d279b9

Please sign in to comment.