commit 3f01285be610c7c34433caf158349a133bdf61b3
Author: Captain_Trojan <sejakm@students.zcu.cz>
Date:   Sat May 15 14:08:16 2021 +0200

    Re #8652 - Removed redundant "== ''" checks for date types.

diff --git a/src/dao/certificate_repository.py b/src/dao/certificate_repository.py
index 2e42509..bcbf958 100644
--- a/src/dao/certificate_repository.py
+++ b/src/dao/certificate_repository.py
@@ -124,7 +124,7 @@ class CertificateRepository:
 
         try:
             sql = (f"SELECT * FROM {TAB_CERTIFICATES} "
-                   f"WHERE {COL_ID} = ? AND ({COL_DELETION_DATE} IS NULL OR {COL_DELETION_DATE} = '')")
+                   f"WHERE {COL_ID} = ? AND ({COL_DELETION_DATE} IS NULL)")
             values = [certificate_id]
             self.cursor.execute(sql, values)
             certificate_row = self.cursor.fetchone()
@@ -200,7 +200,7 @@ class CertificateRepository:
                 values = [filter_type]
 
             sql = (f"SELECT * FROM {TAB_CERTIFICATES} "
-                   f"WHERE ({COL_DELETION_DATE} IS NULL OR {COL_DELETION_DATE} = ''){sql_extension}")
+                   f"WHERE ({COL_DELETION_DATE} IS NULL){sql_extension}")
             self.cursor.execute(sql, values)
             certificate_rows = self.cursor.fetchall()
 
@@ -275,7 +275,7 @@ class CertificateRepository:
             sql = (
                 f"SELECT * "
                 f"FROM {TAB_CERTIFICATES} a "
-                f"WHERE (a.{COL_DELETION_DATE} IS NULL OR a.{COL_DELETION_DATE} = '') "
+                f"WHERE (a.{COL_DELETION_DATE} IS NULL) "
                 f"AND a.{COL_TYPE_ID} IN ({','.join('?' * len(target_types))}) "
             )
             
@@ -446,7 +446,7 @@ class CertificateRepository:
         try:
             sql = (f"UPDATE {TAB_CERTIFICATES} "
                    f"SET {COL_DELETION_DATE} = ? "
-                   f"WHERE {COL_ID} = ? AND ({COL_DELETION_DATE} IS NULL OR {COL_DELETION_DATE} = '')")
+                   f"WHERE {COL_ID} = ? AND ({COL_DELETION_DATE} IS NULL)")
             values = [int(time.time()),
                       certificate_id]
             self.cursor.execute(sql, values)
@@ -473,7 +473,7 @@ class CertificateRepository:
         return self.cursor.rowcount > 0
 
     def set_certificate_revoked(
-            self, certificate_id: int, revocation_date: str, revocation_reason: str = REV_REASON_UNSPECIFIED):
+            self, certificate_id: int, revocation_date: int, revocation_reason: str = REV_REASON_UNSPECIFIED):
         """
         Revoke a certificate
 
@@ -497,7 +497,7 @@ class CertificateRepository:
             sql = (f"UPDATE {TAB_CERTIFICATES} "
                    f"SET {COL_REVOCATION_DATE} = ?, "
                    f"{COL_REVOCATION_REASON} = ? "
-                   f"WHERE {COL_ID} = ? AND ({COL_REVOCATION_DATE} IS NULL OR {COL_REVOCATION_DATE} = '')")
+                   f"WHERE {COL_ID} = ? AND ({COL_REVOCATION_DATE} IS NULL)")
             values = [revocation_date,
                       revocation_reason,
                       certificate_id]
@@ -582,7 +582,7 @@ class CertificateRepository:
 
         try:
             sql = (f"SELECT * FROM {TAB_CERTIFICATES} "
-                   f"WHERE {COL_PARENT_ID} = ? AND {COL_REVOCATION_DATE} IS NOT NULL AND {COL_REVOCATION_DATE} != ''")
+                   f"WHERE {COL_PARENT_ID} = ? AND {COL_REVOCATION_DATE} IS NOT NULL")
             values = [certificate_id]
             self.cursor.execute(sql, values)
             certificate_rows = self.cursor.fetchall()
@@ -654,7 +654,7 @@ class CertificateRepository:
         try:
             sql = (f"SELECT * FROM {TAB_CERTIFICATES} "
                    f"WHERE {COL_PARENT_ID} = ? AND {COL_ID} != ? AND "
-                   f"({COL_DELETION_DATE} IS NULL OR {COL_DELETION_DATE} = '')")
+                   f"({COL_DELETION_DATE} IS NULL)")
             values = [certificate_id, certificate_id]
             self.cursor.execute(sql, values)
             certificate_rows = self.cursor.fetchall()
@@ -734,7 +734,7 @@ class CertificateRepository:
             sql = (
                 f"SELECT * "
                 f"FROM {TAB_CERTIFICATES} a "
-                f"WHERE (a.{COL_DELETION_DATE} IS NULL OR a.{COL_DELETION_DATE} = '') "
+                f"WHERE (a.{COL_DELETION_DATE} IS NULL) "
                 f"AND a.{COL_PARENT_ID} = ? AND a.{COL_ID} != ? "
                 f"AND a.{COL_TYPE_ID} IN ({','.join('?' * len(target_types))}) "
                 
