Skip to content

Commit 1fb4283

Browse files
authored
Merge pull request #223 from LabKey/fb_merge_24.7_to_develop
Merge discvr-24.7 to develop
2 parents 692f6c6 + 08485f4 commit 1fb4283

5 files changed

Lines changed: 91 additions & 4 deletions

File tree

mcc/resources/data/reports.tsv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Flags General query Flags TRUE study flags StartDate FALSE FALSE qcstate/pub
55
demographics General query Demographics TRUE study demographics FALSE FALSE qcstate/publicdata This report displays the demographics data about each animal including species, sex and birth
66
death General query Death Records TRUE study deaths date FALSE FALSE qcstate/publicdata Death records
77
departure General query Shipments TRUE study departure date FALSE FALSE qcstate/publicdata Displays departure dates
8+
arrival General query Arrivals TRUE study arrival date FALSE FALSE qcstate/publicdata Displays arrival dates
89
obs General query Observations TRUE study clinical_observations date FALSE FALSE qcstate/publicdata This report displays observations for the selected animal
910
pedigreePlot Genetics report Pedigree Plot TRUE study pedigree module:EHR/schemas/study/Pedigree/Pedigree.r FALSE FALSE qcstate/publicdata This report will generate a pedigree plot for the selected animal
1011
offspring General query Offspring TRUE study demographicsOffspring FALSE FALSE qcstate/publicdata This report displays pedigree data for animals, including parents, grandparents, siblings and offspring
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<query xmlns="http://labkey.org/data/xml/query">
2+
<metadata>
3+
<tables xmlns="http://labkey.org/data/xml">
4+
<table tableName="demographicsArrival" tableDbType="NOT_IN_DB">
5+
<columns>
6+
<column columnName="Id">
7+
<isKeyField>true</isKeyField>
8+
<isHidden>true</isHidden>
9+
</column>
10+
<column columnName="MostRecentArrival">
11+
<url>/query/executeQuery.view?schemaName=study&amp;
12+
query.queryName=arrival&amp;
13+
query.Id~eq=${Id}&amp;
14+
query.sort=-Date&amp;
15+
</url>
16+
</column>
17+
<column columnName="EarliestArrival">
18+
<url>/query/executeQuery.view?schemaName=study&amp;
19+
query.queryName=arrival&amp;
20+
query.Id~eq=${Id}&amp;
21+
query.sort=-Date&amp;
22+
</url>
23+
</column>
24+
<column columnName="Center_Arrival">
25+
<url>/query/executeQuery.view?schemaName=study&amp;
26+
query.queryName=arrival&amp;
27+
query.Id~eq=${Id}&amp;
28+
query.sort=-Date&amp;
29+
</url>
30+
<columnTitle>Arrival At Center</columnTitle>
31+
</column>
32+
</columns>
33+
<titleColumn>MostRecentArrival</titleColumn>
34+
</table>
35+
</tables>
36+
</metadata>
37+
</query>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2010-2019 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
5+
*/
6+
SELECT
7+
d.Id AS Id,
8+
9+
T1.MostRecentArrival,
10+
11+
T2.EarliestArrival,
12+
13+
coalesce(T2.EarliestArrival, d.birth) as Center_Arrival
14+
15+
FROM study.demographics d
16+
17+
18+
--date of most recent arrival
19+
LEFT JOIN
20+
(select T1.Id, max(T1.date) as MostRecentArrival FROM study.arrival T1 WHERE T1.qcstate.publicdata = true GROUP BY T1.Id) T1
21+
ON (T1.Id = d.Id)
22+
23+
--date of first arrival
24+
LEFT JOIN
25+
(select T1.Id, min(T1.date) as EarliestArrival FROM study.arrival T1 WHERE T1.qcstate.publicdata = true GROUP BY T1.Id) T2
26+
ON (T2.Id = d.Id)

mcc/resources/referenceStudy/study/datasets/datasets_metadata.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,9 @@
558558
<column columnName="estimated">
559559
<datatype>boolean</datatype>
560560
</column>
561+
<column columnName="mccRequestId">
562+
<datatype>integer</datatype>
563+
</column>
561564
</columns>
562565
<tableTitle>Arrival</tableTitle>
563566
</table>

mcc/resources/web/mcc/window/MarkShippedWindow.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Ext4.define('MCC.window.MarkShippedWindow', {
2121
var ctx = MCC.Utils.getMCCContext();
2222
Ext4.apply(this, {
2323
bodyStyle: 'padding: 5px;',
24-
width: 500,
24+
width: 650,
2525
modal: true,
2626
title: 'Mark ID Shipped',
2727
defaults: {
@@ -93,7 +93,14 @@ Ext4.define('MCC.window.MarkShippedWindow', {
9393
handler: function(btn){
9494
btn.up('window').close();
9595
}
96-
}]
96+
}],
97+
listeners: {
98+
show: function(win){
99+
if (win.getHeight() > Ext4.getBody().getHeight()) {
100+
win.alignTo(Ext4.getBody(), 't-t?');
101+
}
102+
}
103+
}
97104
});
98105

99106
this.callParent(arguments);
@@ -104,6 +111,10 @@ Ext4.define('MCC.window.MarkShippedWindow', {
104111
xtype: 'displayfield',
105112
value: 'Animal ID',
106113
width: 150
114+
},{
115+
xtype: 'displayfield',
116+
value: 'Request ID',
117+
width: 150
107118
},{
108119
xtype: 'displayfield',
109120
value: 'Keep Existing ID?',
@@ -127,6 +138,7 @@ Ext4.define('MCC.window.MarkShippedWindow', {
127138
xtype: 'checkbox',
128139
itemId: 'usePreviousId-' + animalId,
129140
checked: false,
141+
style: 'margin-left: 5px;',
130142
listeners: {
131143
scope: this,
132144
change: function (field, val) {
@@ -146,8 +158,9 @@ Ext4.define('MCC.window.MarkShippedWindow', {
146158
return {
147159
layout: {
148160
type: 'table',
149-
columns: 3
161+
columns: 4
150162
},
163+
width: 600,
151164
border: false,
152165
defaults: {
153166
style: 'padding:5px;',
@@ -201,7 +214,7 @@ Ext4.define('MCC.window.MarkShippedWindow', {
201214
schemaName: 'study',
202215
queryName: 'Demographics',
203216
filterArray: [LABKEY.Filter.create('lsid', lsids.join(';'), LABKEY.Filter.Types.IN)],
204-
columns: 'Id,gender,colony,species,birth,death,center,Id/MostRecentDeparture/MostRecentDeparture,Id/mccAlias/externalAlias,calculated_status,dam,sire,damMccAlias/externalAlias,sireMccAlias/externalAlias',
217+
columns: 'Id,gender,colony,species,birth,death,center,Id/MostRecentDeparture/MostRecentDeparture,Id/MostRecentArrival/MostRecentArrival,Id/mccAlias/externalAlias,calculated_status,dam,sire,damMccAlias/externalAlias,sireMccAlias/externalAlias',
205218
scope: this,
206219
failure: LDK.Utils.getErrorCallback(),
207220
success: function(results) {
@@ -306,7 +319,13 @@ Ext4.define('MCC.window.MarkShippedWindow', {
306319
objectId: null
307320
}]
308321
});
322+
}
309323

324+
var shouldAddArrival = !row['Id/MostRecentArrival/MostRecentArrival'] ||
325+
row['Id/MostRecentArrival/MostRecentArrival'] !== Ext4.Date.format(row.effectiveDate, 'Y-m-d') ||
326+
row['Id/MostRecentArrival/mccRequestId'] !== requestId ||
327+
row.Id !== effectiveId;
328+
if (shouldAddArrival) {
310329
// And also add an arrival record. NOTE: set the date after the departure to get status to update properly
311330
var arrivalDate = new Date(effectiveDate).setMinutes(effectiveDate.getMinutes() + 1);
312331
commands.push({
@@ -318,6 +337,7 @@ Ext4.define('MCC.window.MarkShippedWindow', {
318337
Id: effectiveId,
319338
date: arrivalDate,
320339
source: centerName,
340+
mccRequestId: requestId,
321341
QCState: null,
322342
QCStateLabel: 'Completed',
323343
objectId: null

0 commit comments

Comments
 (0)