Author Topic: Pointrating?  (Read 28838 times)

0 Members and 1 Guest are viewing this topic.

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Pointrating?
« on: January 18, 2006, 07:20:10 PM »
I search a way to change the result for votes
Now its cut through, i will add the votes.

For Example: 5 Votes
3
4
2
5
1

Now its  3 / 5 Votes
I will that the result is 15

I hope you understand my english :D


In Deutsch:
Ich suche nach einer möglichkeit die Ergebnisse für die Abstimmungen zu Ändern.
Jetzt ist es der Durchschnitt, ich will die Abstimmungen Addieren.

Zum Beispiel, 5 Abstimmungen
3
4
2
5
1

Jetzt ist es 3 / 5
Ich will das 15 Rauskommt.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Pointrating?
« Reply #1 on: January 18, 2006, 09:52:29 PM »
hallo dosensteck,

für eine Bildbewertung nach gesammelten Gesamtpunkten (neue Punkt = alte Punkte + gewerte Punkte), also dann nicht mehr nach Punkte-Durchschnitt wie bisher, musst du die function update_image_rating in der /includes/functions.php wie folgt ändern :

Code: [Select]
function update_image_rating($image_id, $rating) {
  global $site_db;
  $sql = "SELECT cat_id, image_votes, image_rating
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (check_permission("auth_vote", $image_row['cat_id'])) {
    $old_votes = $image_row['image_votes'];
    $old_rating = $image_row['image_rating'];
    $new_rating = $old_rating + $rating;
    $sql = "UPDATE ".IMAGES_TABLE."
            SET image_votes = ($old_votes + 1), image_rating = '$new_rating'
            WHERE image_id = $image_id";
    $site_db->query($sql);
  }
}

ist ungetestet, müsste aber nach meinem mathematischen Verständnis funktionieren ...  :wink:

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Pointrating?
« Reply #2 on: January 18, 2006, 10:24:26 PM »
hört sich gut an, nur wie kann ich nun die Votes rückwirkend addieren? oder geht das nichtmehr? Achja, ich habe den Votes saved in DB mod Installiert :)

Danke erstmal für deine Bemühungen, werde das gleich mal austesten :)

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Pointrating?
« Reply #3 on: January 18, 2006, 10:39:22 PM »
... da must du wohl in deinem Bewertungssystem einen radikalen Neuanfang machen, da mit der orig. function update_image_rating immer gleich der neue Punkte-Durchschnitt berechnet und so dann in der "IMAGES_TABLE" unter "image_rating" gespeichert wird ... es lässt sich also rückwirkend keine Rating-Summe der bisher abgegebenen Bewertungen mehr ermitteln ... !

... bedenke aber, dass mit jeder Änderung des Bewertungsmodus die vorherige Bewertung der Bilder hinfällig wird ...

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Pointrating?
« Reply #4 on: January 18, 2006, 10:48:54 PM »
habe ich befürchtet... werde das aber wohl doch durchziehen da ich die bewertung so intelligenter finde... Ausserdem kann der Durchschnitt der Bewertungen nicht durch einen miesen Vote nach unten gesetzt werden.

Aufjedenfall danke für die Hilfe :)

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Pointrating?
« Reply #5 on: January 18, 2006, 11:02:04 PM »
... der momentane Gesamt-Punktewert deiner Bilder ergibt sich ja aus : "image_rating" x "image_votes" ...
... du könnest also alle Bilder per Hand umbewerten ...
... oder ein kleines Script könnte das für dich übernehmen, dass du einmal durchlaufen lassen müsstest ...  :wink:

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Pointrating?
« Reply #6 on: January 19, 2006, 05:18:19 PM »
Per hand ist schwer bei ca. 1000 Bildern wovon ca. die hälfte bewertungen hat...

In php bin ich nicht so Fit das ich das kleine Script schreiben könnte, leider...(Lerne zwar fleissig, vieles geht aber einfach nochnicht)

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Pointrating?
« Reply #7 on: January 19, 2006, 10:15:16 PM »
Ich nochmal, vielleicht ein wenig nervig :D

Also ich hab mir jetzt gedanken gemacht, das mit dem kleinen script wäre natürlich die beste Lösung und diese versuche ich jetzt auch hinzubekommen...

Aber jetzt stellt sich mir die frage

Code: [Select]
  $sql = "SELECT  image_id, image_votes, image_rating 
WHERE image_id = $image_id
          FROM ".IMAGES_TABLE.";

$votes = $row['image_votes'];
$rating = $row['image_rating'];

$new_rating = $votes * $rating;

  $sql = "UPDATE ".IMAGES_TABLE."
          SET image_rating = $new_rating
          WHERE image_id = $image_id";

Frage nun, würde das so funktionieren? Ich will mir natürlich nicht die Einträge in der Datenbank zerstören...
Und probleme habe ich mit $image_id - woher bekomme ich die? ich will ja das die richtige spalte das update bekommt... Bei sovielen Einträgen ist das natürlich nicht so angenehm...

Wie gesagt, kann Php nicht so besonders - habe jetzt schon ziemlich lange gegoogelt ob vielleicht jemand mal vor einem ähnlichen problem stand - leider erfolglos :/



Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Pointrating?
« Reply #8 on: January 20, 2006, 12:38:37 AM »
@dosensteck :

First, I'd like to apologize - I do not speak german. Hopefully, you'll understand what I'm writing.

This block :

Quote

$sql = "SELECT  image_id, image_votes, image_rating
WHERE image_id = $image_id
          FROM ".IMAGES_TABLE.";


should be replaced with :

Code: [Select]

$sql = "

SELECT image_id, image_votes, image_rating
FROM ".IMAGES_TABLE."
WHERE image_id = ".$image_id;


and this block :

Quote

$sql = "UPDATE ".IMAGES_TABLE."
          SET image_rating = $new_rating
          WHERE image_id = $image_id";


should be replaced with this one :

Code: [Select]

$sql = "

UPDATE ".IMAGES_TABLE."
SET image_rating = '$new_rating'
WHERE image_id = ".$image_id;


;)

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Pointrating?
« Reply #9 on: January 20, 2006, 06:41:29 PM »
THX for the help, i would only show how i will do this (the code was not tested).

I want to multiply votes and rating, for all images (my problem)... an update the image_rating with the result with new rating (shown in the code).

But im afraid to test it or do it - im not god in php and its not so easy for me :/

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Pointrating?
« Reply #10 on: January 20, 2006, 07:36:31 PM »
@dosensteck

... nur mal auf die Schnelle ...  :wink:
... das "Umrechnungs-Script" sollte zur Vereinfachung wie ein Plugin laufen ...
... schau dir das z.B. mal hier an ...
... bei etwas mehr Zeit werde ich etwas davon hier reinstecken ... ggf. wird aber auch TheOracle noch tätig ...  :wink:

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Pointrating?
« Reply #11 on: January 20, 2006, 08:43:47 PM »
@mawenzi:

Quote

... nur mal auf die Schnelle ...  Wink
... das "Umrechnungs-Script" sollte zur Vereinfachung wie ein Plugin laufen ...
... schau dir das z.B. mal hier an ...
... bei etwas mehr Zeit werde ich etwas davon hier reinstecken ... ggf. wird aber auch TheOracle noch tätig ...


Would it be possible to state this in english ?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Pointrating?
« Reply #12 on: January 21, 2006, 12:39:54 AM »
@ TheOracle
... dosensteck would like absolute points of image rating on his website ...
... therefore he need a little Plugin for converting its image ratings ...
... converting all image ratings one time : 'old_image_rating' -> 'image_rating' , 'new_image_rating' -> 'image_votes' * 'image_rating'
... an saving 'new_image_rating' as 'image_rating' in 'IMAGES_TABLE' ...
... and I said ... TheOracle is the man for Plugins ... and sometimes he has the time for editing such a plugin ...  :wink:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Pointrating?
« Reply #13 on: January 21, 2006, 01:32:28 AM »
Quote

TheOracle is the man for Plugins


And more but still greatly appreciated for your input. ;)

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Pointrating?
« Reply #14 on: January 22, 2006, 11:41:18 AM »
... bei etwas mehr Zeit werde ich etwas davon hier reinstecken ... ggf. wird aber auch TheOracle noch tätig ...  :wink:

mawenzi

wäre super!

ich kanns leider nicht wirklich :/

lg