From c7aa4355f8c73797f35bd68026a9433ad9d8bfe2 Mon Sep 17 00:00:00 2001 From: Ghost141 Date: Thu, 16 Oct 2014 18:41:00 +0800 Subject: [PATCH] Update for srm practice problems api 1. Set default value "New" for "status" field. --- queries/get_practice_problems | 4 ++-- queries/get_practice_problems_count | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/queries/get_practice_problems b/queries/get_practice_problems index 346f23295..01e3feaf2 100644 --- a/queries/get_practice_problems +++ b/queries/get_practice_problems @@ -16,7 +16,7 @@ SELECT WHEN (p.problem_type_id = 1 AND p.proposed_difficulty_id = 3) THEN 'Hard'::nvarchar(50) END AS difficulty , rc.points -, CASE WHEN EXISTS ( +, NVL(CASE WHEN EXISTS ( SELECT 1 FROM component_state cs WHERE cs.status_id < 120 @@ -57,7 +57,7 @@ SELECT AND pcs.status_id != 150 AND pcs.coder_id = @userId@ ) THEN 'Viewed'::nvarchar(50) - END AS status + END, 'New') AS status , NVL(( SELECT points diff --git a/queries/get_practice_problems_count b/queries/get_practice_problems_count index 67f905441..b447e2ea7 100644 --- a/queries/get_practice_problems_count +++ b/queries/get_practice_problems_count @@ -13,7 +13,7 @@ SELECT WHEN (p.problem_type_id = 1 AND p.proposed_difficulty_id = 3) THEN 'Hard'::nvarchar(50) END AS difficulty , rc.points -, CASE WHEN EXISTS ( +, NVL(CASE WHEN EXISTS ( SELECT 1 FROM component_state cs WHERE cs.status_id < 120 @@ -54,7 +54,7 @@ SELECT AND pcs.status_id != 150 AND pcs.coder_id = @userId@ ) THEN 'Viewed'::nvarchar(50) - END AS status + END, 'New') AS status , NVL(( SELECT points