tango-app-api-audit 3.4.13 → 3.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-audit",
3
- "version": "3.4.13",
3
+ "version": "3.4.15",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2304,6 +2304,11 @@ export async function userMetrics( req, res ) {
2304
2304
  $and: filter,
2305
2305
  },
2306
2306
  },
2307
+ {
2308
+ $sort: {
2309
+ createdAt: -1,
2310
+ },
2311
+ },
2307
2312
  {
2308
2313
  $project: {
2309
2314
  userId: 1,
@@ -2319,7 +2324,7 @@ export async function userMetrics( req, res ) {
2319
2324
  },
2320
2325
  {
2321
2326
  $sort: {
2322
- endTime: -1,
2327
+ createdAt: -1,
2323
2328
  },
2324
2329
  },
2325
2330
  {
@@ -2330,8 +2335,8 @@ export async function userMetrics( req, res ) {
2330
2335
  totalCompletedFiles: { $sum: '$totalCompletedFiles' },
2331
2336
  beforeCount: { $sum: '$beforeCount' },
2332
2337
  afterCount: { $sum: '$afterCount' },
2333
- checkIntime: { $first: '$startTime' },
2334
- checkOutTime: { $first: '$endTime' },
2338
+ checkIntime: { $last: '$startTime' },
2339
+ checkOutTime: { $first: { $ifNull: [ '$endTime', '$startTime' ] } },
2335
2340
  createdAt: { $first: '$createdAt' },
2336
2341
  to: { $last: '$createdAt' },
2337
2342
 
@@ -2908,6 +2908,11 @@ export async function userMetrics( req, res ) {
2908
2908
  $and: filter,
2909
2909
  },
2910
2910
  },
2911
+ {
2912
+ $sort: {
2913
+ createdAt: -1,
2914
+ },
2915
+ },
2911
2916
 
2912
2917
  {
2913
2918
  $project: {
@@ -2928,7 +2933,7 @@ export async function userMetrics( req, res ) {
2928
2933
  },
2929
2934
  {
2930
2935
  $sort: {
2931
- endTime: -1,
2936
+ createdAt: -1,
2932
2937
  },
2933
2938
  },
2934
2939
  {
@@ -2939,8 +2944,8 @@ export async function userMetrics( req, res ) {
2939
2944
  totalCompletedFiles: { $sum: '$totalCompletedFiles' },
2940
2945
  beforeCount: { $sum: '$beforeCount' },
2941
2946
  afterCount: { $sum: '$afterCount' },
2942
- checkIntime: { $first: '$startTime' },
2943
- checkOutTime: { $first: '$endTime' },
2947
+ checkIntime: { $last: '$startTime' },
2948
+ checkOutTime: { $first: { $ifNull: [ '$endTime', '$startTime' ] } },
2944
2949
  moduleType: { $last: '$moduleType' },
2945
2950
  value: { $last: '$value' },
2946
2951
  createdAt: { $first: '$createdAt' },
@@ -155,8 +155,8 @@ const mapFunction = async ( chunkData, filterData ) => {
155
155
  chunkData.find( ( item ) => {
156
156
  if ( mappedId.img_name === item.temp_ids ) {
157
157
  item.temp_ids = data.img_name;
158
- mappedId.img_name === data.img_name? null: item.query_status = '';
159
- item.demographic = data.demographic || '';
158
+ ( mappedId.img_name !== data.img_name )? item.query_status = '': null;
159
+ item.demographic = data.demographic || '';
160
160
  }
161
161
  } );
162
162
  }