my_forum 0.0.1.beta47 → 0.0.1.beta48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b33c4cb82573653aa48a66e05ffa1d5b1046183
4
- data.tar.gz: aed7d3f0d1e8dd3f1ef10ccb29bd85d2bd758322
3
+ metadata.gz: 0a7013ef470e6fa60f3ed699a437a201a3f71232
4
+ data.tar.gz: 59013c7b8217eca43a2b863253ca1a8d6c995593
5
5
  SHA512:
6
- metadata.gz: 7e3a752f9498e68cdc9c6df35974fde15c947ba02ad19c8efeb00d0ccb1d0e170d595b75886df92d510c52fee26e0f99b18c86ade254150bf208af2b3c4e738f
7
- data.tar.gz: f5cb24e415e17ccf7eb6380be754601398f3ce6979a6397cf9cb34fd1c42fa9b02afa1ff489aba2f526859f531a2dcdb6230259c20eb1917c4a5e43333e23b32
6
+ metadata.gz: 609f4f175e760199a842ffb5aac2dfa317aeb5641ffe2e614199db265cd7a8eabd024a52f15d40f663672974a47b7c18621357fa139f98f662c820eb4da661bf
7
+ data.tar.gz: 6320edd1026ee61daa9ddb51ada12df1a88c4716a512ec4ddd97510d98f6bb04f5e13d15aae179b1cd0794f85cab0bff122a8b9722d8d5eb2eb909c6ef290ba3
@@ -9,17 +9,11 @@ module MyForum
9
9
  SELECT
10
10
  my_forum_topics.name AS topic_name,
11
11
  my_forum_topics.forum_id,
12
-
13
-
14
12
  my_forum_topics.id,
15
13
  my_forum_topics.latest_post_created_at AS post_created_at,
16
14
  my_forum_topics.latest_post_login AS user_login
17
-
18
-
19
15
  FROM my_forum_topics
20
-
21
16
  WHERE my_forum_topics.forum_id = #{self.id}
22
-
23
17
  LIMIT 1
24
18
  ").first
25
19
  end
@@ -33,12 +27,13 @@ module MyForum
33
27
 
34
28
  def topics_with_latest_post_info(page: 0, per_page: 30)
35
29
  Topic.paginate_by_sql("
36
- SELECT my_forum_topics.*, my_forum_users.login AS last_post_user_login, my_forum_posts.created_at AS last_post_time
30
+ SELECT
31
+ my_forum_topics.*,
32
+ my_forum_topics.latest_post_created_at AS last_post_time,
33
+ my_forum_topics.latest_post_login AS last_post_user_login
37
34
  FROM my_forum_topics
38
- JOIN my_forum_posts ON my_forum_posts.id = my_forum_topics.latest_post_id
39
- JOIN my_forum_users ON my_forum_posts.user_id = my_forum_users.id
40
35
  WHERE my_forum_topics.forum_id = #{self.id} AND my_forum_topics.deleted IS FALSE
41
- ORDER BY my_forum_topics.pinned DESC, my_forum_posts.id DESC
36
+ ORDER BY my_forum_topics.pinned DESC
42
37
  ", page: page, per_page: per_page)
43
38
  end
44
39
 
@@ -47,12 +42,13 @@ module MyForum
47
42
  log_topic_ids = [0] if log_topic_ids.empty?
48
43
 
49
44
  Topic.paginate_by_sql("
50
- SELECT my_forum_topics.*, my_forum_users.login AS last_post_user_login, my_forum_posts.created_at AS last_post_time
45
+ SELECT
46
+ my_forum_topics.*,
47
+ my_forum_topics.latest_post_created_at AS last_post_time,
48
+ my_forum_topics.latest_post_login AS last_post_user_login
51
49
  FROM my_forum_topics
52
- JOIN my_forum_posts ON my_forum_posts.id = my_forum_topics.latest_post_id
53
- JOIN my_forum_users ON my_forum_posts.user_id = my_forum_users.id
54
50
  WHERE my_forum_topics.id NOT IN (#{log_topic_ids.join(',')}) AND my_forum_topics.deleted IS FALSE
55
- ORDER BY my_forum_posts.id DESC
51
+ ORDER BY my_forum_topics.id DESC
56
52
  ", page: page, per_page: per_page)
57
53
  end
58
54
 
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1.beta47"
2
+ VERSION = "0.0.1.beta48"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_forum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta47
4
+ version: 0.0.1.beta48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Omelchenko