twenty-server 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68a17bb6b5dd5dc2664d312e015c25ec234b08eb6a7e5dfaa4d6d1e69d2f4919
4
- data.tar.gz: 5fa5b26c23ca13145d8ab23ed80cee46b96d40d962d32074f678f254a85e4b63
3
+ metadata.gz: 586b411b7901b68e979b8640282eea96470b4433481d1785bff14cdf3bddcc78
4
+ data.tar.gz: c8b7b7e848bc6525f62d2512757066cca27bdc7dbb0dd055961738b18c84a256
5
5
  SHA512:
6
- metadata.gz: 7f030d5db1dd6cd145192e6b4ef3eaef21e8bef523d6b982bc20dbb9d69867d5fb7493cf02eeca49f5a5ab187a639d5442a238876fe073d1890695ff33bbbc74
7
- data.tar.gz: 6d32606c2ea0e8e8356b9f6fe3dd9429baffd8aa74317ab95784edc985817d33b2ff1baa7f1b65ffb5cd7742f769e0edf98ac70b18f6994cbd2d1c397169097b
6
+ metadata.gz: 5ca0d2eca6285ff6c9d7972be1d4a2c0a0c57dbf5edca4d8d07055a49617b12b5d9c2ee6a55142ce2e00cdb3696ec7db8a64fe94d4e3f69b6ef137bd04912996
7
+ data.tar.gz: 7b9e1f4c67fccb62dfe4de1c87e86d642e5c8744ccaacc7adfe79d3d18ce160388ed677c0e1131a3f65da9bd24e6fea5f6f12da5d296e238dc54b4404c641b39
@@ -7,5 +7,6 @@ module Twenty::GraphQL::Type
7
7
  field :path, String, null: false
8
8
  field :color, String, null: false
9
9
  field :tasks, "[Twenty::GraphQL::Type::Task]", null: false
10
+ field :open_task_count, Integer, null: false
10
11
  end
11
12
  end
@@ -23,7 +23,10 @@ module Twenty::GraphQL::Type
23
23
  end
24
24
 
25
25
  def projects
26
- Twenty::Project.all
26
+ Twenty::Project
27
+ .all
28
+ .sort_by { _1.open_task_count }
29
+ .reverse
27
30
  end
28
31
  end
29
32
  end
@@ -14,4 +14,14 @@ class Twenty::Project < Sequel::Model
14
14
  def path
15
15
  super&.sub(Dir.home, "~")
16
16
  end
17
+
18
+ ##
19
+ # @return [Integer]
20
+ # Returns the number of open tasks a project has.
21
+ def open_task_count
22
+ @open_task_count ||= Twenty::Task
23
+ .where(project_id: id)
24
+ .where(Sequel.lit("status IN (0,1,2)"))
25
+ .count
26
+ end
17
27
  end
@@ -38,6 +38,7 @@ type Project {
38
38
  color: String!
39
39
  id: Int!
40
40
  name: String!
41
+ openTaskCount: Int!
41
42
  path: String!
42
43
  tasks: [Task!]!
43
44
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twenty-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'