Project

General

Profile

« Previous | Next » 

Revision 41982

Added by Nikon Gasparis over 8 years ago

updated queries to cast score as integer

View differences:

modules/uoa-validator-commons/trunk/src/main/java/eu/dnetlib/validator/commons/dao/jobs/JobsDAOImpl.java
398 398
				if (jobStatus.equalsIgnoreCase("ongoing"))
399 399
					beginQuery += " AND (j.content_job_status='ongoing' OR j.usage_job_status='ongoing')";
400 400
				else if (jobStatus.equalsIgnoreCase("successful"))
401
					beginQuery += " AND ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND j.content_job_score > '50' AND j.usage_job_score > '50')" +
402
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score > '50')" +
403
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score > '50'))";
401
					beginQuery += " AND ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND j.content_job_score::integer > '50' AND j.usage_job_score::integer > '50')" +
402
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score::integer > '50')" +
403
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score::integer > '50'))";
404 404
				else if (jobStatus.equalsIgnoreCase("failed"))
405
					beginQuery += " AND ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND (j.content_job_score <= '50' OR j.usage_job_score <= '50'))" +
406
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score <= '50')" +
407
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score <= '50'))";
405
					beginQuery += " AND ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND (j.content_job_score::integer <= '50' OR j.usage_job_score::integer <= '50'))" +
406
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score::integer <= '50')" +
407
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score::integer <= '50'))";
408 408
			}
409 409
			if (offset != null) {
410 410
				endQuery += " OFFSET ?";
......
512 512
				if (jobStatus.equalsIgnoreCase("ongoing"))
513 513
					query += " (j.content_job_status='ongoing' OR j.usage_job_status='ongoing')";
514 514
				else if (jobStatus.equalsIgnoreCase("successful"))
515
					query += " ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND j.content_job_score > '50' AND j.usage_job_score > '50')" +
516
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score > '50')" +
517
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score > '50'))";
515
					query += " ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND j.content_job_score::integer > '50' AND j.usage_job_score::integer > '50')" +
516
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score::integer > '50')" +
517
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score::integer > '50'))";
518 518
				else if (jobStatus.equalsIgnoreCase("failed"))
519
					query += " ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND (j.content_job_score <= '50' OR j.usage_job_score <= '50'))" +
520
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score <= '50')" +
521
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score <= '50'))";
519
					query += " ((j.validation_type='CU' AND j.content_job_status='finished' AND j.usage_job_status='finished' AND (j.content_job_score::integer <= '50' OR j.usage_job_score::integer <= '50'))" +
520
							" OR (j.validation_type='C' AND j.content_job_status='finished' AND j.usage_job_status='none' AND j.content_job_score::integer <= '50')" +
521
							" OR (j.validation_type='U' AND j.content_job_status='none' AND j.usage_job_status='finished' AND j.usage_job_score::integer <= '50'))";
522 522
			}
523 523
			logger.debug(query);
524 524
			stmt = con.prepareStatement(query);

Also available in: Unified diff