Jeff VIP
Total posts: 745
08 Май 2013 00:28

Hi Sergey,

I'm using the Komento adapter v8.13 and the number of comments in a record are not being calculated. Can you verify that?

Best regards,

Jeff

Последние изменения: 01 Сен 2019


Sergey
Total posts: 13,748
08 Май 2013 02:23

No I cannot confirm. It does show comment numbers on my local development site. may be you set comments moderation and it is not calculated until published?


Jeff VIP
Total posts: 745
08 Май 2013 03:30

No my settings are fine. All comments are published and visible. The comment numbers all showed '0' after installing the latest updates.

Sergey try this:

Reinstall over your current local dev site:

  • pkg_cobalt.v.8.74.zip

  • pkg_cobalt.media.v.8.48.zip

  • cmt_cobalt.komento.v.8.13.zip

and check again please....


Jeff VIP
Total posts: 745
08 Май 2013 03:59

So:

  • Installing cmt_cobalt.komento.v.8.13.zip: all comments nrs are '0'

  • Reinstalling older cmt_cobalt.komento.v.8.11.zip: correct comments nrs show up again

This is tested on both my local and web dev sites :S


Sergey
Total posts: 13,748
08 Май 2013 07:18

It will work only with Komento released today or tomorrow as I asked stackide's people. The new Cobalt integration plugin in Komento will be only there.


Jeff VIP
Total posts: 745
09 Май 2013 02:56

Hi Sergey,

I installed the latest Komento version, but the comments already posted are not included in the calculation. It seems to work only after adding a new comment to each record :S

Now I am a bit worried.

Can you imagine what the implications are on a live site?

Does installing updates of Komento (or the Cobalt Komento adapter) imply that I have to add a comment to each record just to show its correct number of comments? You have to agree with me that would be very inconvenient :S

Please tell me you have a solution.....

Best regards,

Jeff


Sergey
Total posts: 13,748
09 Май 2013 05:01

installed the latest Komento version, but the comments already posted are not included in the calculation. It seems to work only after adding a new comment to each record

Right. because comments calculation is dome only on comment save.

installed the latest Komento version, but the comments already posted are not included in the calculation. It seems to work only after adding a new comment to each record

Can you imagine what the implications are on a live site?

I know. This is what we generally want to avoid. But in old scheme integration run SQL query every time to calculate comments. It means on the page with 20 records it is additional 20 queries. We though that with time it will be all recalculated slowly one by one when users will write comments.

installed the latest Komento version, but the comments already posted are not included in the calculation. It seems to work only after adding a new comment to each record

Can you imagine what the implications are on a live site?

Please tell me you have a solution.....

You can try to run SQL query like this

UPDATE jos_js_res_record AS r SET r.`comments` = (SELECT COUNT(*) FROM jos_komento_comments WHERE `published` = 1 AND `component` = 'com_cobalt' AND cid = r.id) AND r.`type_id` = 2

Where type_id = 2 should be equal to type ID you set komento for.


Jeff VIP
Total posts: 745
09 Май 2013 05:46

Right. because comments calculation is dome only on comment save.

Smart thing to do

Right. because comments calculation is dome only on comment save.

I know. This is what we generally want to avoid. But in old scheme integration run SQL query every time to calculate comments. It means on the page with 20 records it is additional 20 queries. We though that with time it will be all recalculated slowly one by one when users will write comments.

You are right. Unfortunately in my case, installing the Komento adapter update caused a reset of all calculations to 0 :S

UPDATE xxxx_js_res_record AS r SET r.`comments` = (SELECT COUNT(*) FROM xxxx_komento_comments WHERE `published` = 1 AND `component` = 'com_cobalt' AND cid = r.id) AND r.`type_id` = 1

Results in setting number of comments to 1 (records with comments)

:S

UPDATE xxxx_js_res_record AS r SET r.`comments` = (SELECT COUNT(*) FROM xxxx_komento_comments WHERE `published` = 1 AND `component` = 'com_cobalt' AND cid = r.id) AND r.`type_id` = 2

Results in setting number of comments to 0 (records with and without comments)

:S


Sergey
Total posts: 13,748
09 Май 2013 06:22

:S

And if you add comment it updates correctly?


Jeff VIP
Total posts: 745
09 Май 2013 07:11

And if you add comment it updates correctly?

Yes, but only for that record.


Sergey
Total posts: 13,748
09 Май 2013 08:19

Unfortunately if above code does not work I have no other solution :(


Jeff VIP
Total posts: 745
09 Май 2013 08:41

ok, Let us hope that this is just beginners tough luck :)

Thank you for trying to solve this


Sergey
Total posts: 13,748
10 Май 2019 12:06

Today I've checked the code again and лomento API. Eveyrthing is correct and should continue to work.

Работает на Cobalt