Bläddra i källkod

Add support for "application_considered" flag

jherve 1 år sedan
förälder
incheckning
944f5da9c1
3 ändrade filer med 14 tillägg och 0 borttagningar
  1. 5 0
      native/src/job_search/job_storage.py
  2. 8 0
      src/Content.js
  3. 1 0
      src/NativeMessage.purs

+ 5 - 0
native/src/job_search/job_storage.py

@@ -45,6 +45,9 @@ def convert_to_parse_result(url):
     elif isinstance(url, ParseResult):
         return url
 
+def convert_to_bool(s: str) -> bool:
+    return s == "true" or s == "yes" or s == "1"
+
 
 @dataclass
 class JobOffer:
@@ -65,6 +68,7 @@ class JobOffer:
     publication_date: date = None
     xp_required: int | None = None
     first_seen_date: datetime | None = None
+    application_considered: bool | None = None
     application_date: date | None = None
     application_rejection_date: date | None = None
     contract_type: ContractType | None = ContractType.CDI
@@ -109,6 +113,7 @@ class JobOffer:
             ("xp_required", int),
             ("first_seen_date", parsedate_to_datetime),
             ("publication_date", date.fromisoformat),
+            ("application_considered", convert_to_bool),
             ("application_date", date.fromisoformat),
             ("application_rejection_date", date.fromisoformat),
         ]:

+ 8 - 0
src/Content.js

@@ -1,6 +1,8 @@
 const rejected_color = "rgb(255, 108, 108)";
 const applied_color = "rgb(236, 253, 207)";
 const seen_color = "rgb(204, 241, 255)";
+const considered_color = "rgb(255, 247, 204)";
+const dismissed_color = "rgb(255, 195, 177)";
 
 export function colorVisitedJobsLoopImpl () {
     // Add a div on the left side that displays a legend of the color used in the UI
@@ -9,6 +11,8 @@ export function colorVisitedJobsLoopImpl () {
         <div id="jobs-search-legend" style="position: absolute; top: 50%; background: white;">
             <p style="background: ${seen_color}">Seen</p>
             <p style="background: ${applied_color}">Applied</p>
+            <p style="background: ${considered_color}">Application considered</p>
+            <p style="background: ${dismissed_color}">Application dismissed</p>
             <p style="background: ${rejected_color}">Rejected</p>
         </div>
     `;
@@ -34,6 +38,10 @@ function getBackgroundColor(job) {
         return rejected_color;
     else if (job.application_date)
         return applied_color;
+    else if (job.application_considered === true)
+        return considered_color;
+    else if (job.application_considered === false)
+        return dismissed_color;
     else
         return seen_color;
 }

+ 1 - 0
src/NativeMessage.purs

@@ -72,6 +72,7 @@ type NativePythonJobOffer = {
   company_url :: Maybe String,
   flexibility :: Maybe JobFlexibility,
   application_process :: Maybe ApplicationProcess,
+  application_considered :: Maybe Boolean,
   application_date :: Maybe String,
   application_rejection_date :: Maybe String
 }