opportunity: meetups hash also rely on timestamp
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 29 Oct 2014 21:53:59 +0000 (17:53 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 30 Oct 2014 16:00:53 +0000 (12:00 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/opportunity/src/opportunity_controller.nit
contrib/opportunity/src/opportunity_model.nit

index 73e1d2e..831d90d 100644 (file)
@@ -87,14 +87,13 @@ class OpportunityWelcome
                        end
                        if not meet.commit(db) then
                                db.close
-                               var meetid = (mname + mdate + mplace).sha1_to_s
                                var rsp = new HttpResponse(200)
                                var meetpage = new MeetupCreationPage
                                meetpage.meet = meet
                                meetpage.ans = ansset
                                meetpage.error = """<p>Could not create Meetup.</p>
-                               <p>Hmm, that's embarassing, there already seems to be a Meetup like yours <a href="/?meetup_id={{{meetid}}}">here</a>.</p>
-                               <p>If this is not yours, please contact the mainainers of the website, you might have found a bug !</p>"""
+                               <p>Hmm, that's embarassing, the database indicates that your meetup already exists.</p>
+                               <p>If this is not a duplicated submission, please contact the mainainers of the website, you might have found a bug !</p>"""
                                rsp.body = meetpage.write_to_string
                                return rsp
                        end
index 79011e0..aa9adec 100644 (file)
@@ -223,7 +223,8 @@ class Meetup
 
        redef fun commit(db) do
                if id == "" then
-                       var tmpid = (name + date + place).sha1_to_s
+                       var time = get_time
+                       var tmpid = (name + date + place + time.to_s).sha1_to_s
                        if not db.execute("INSERT INTO meetups (id, name, date, place) VALUES({tmpid.to_sql_string}, {name.to_sql_string}, {date.to_sql_string}, {place.to_sql_string});") then
                                print "Error recording entry Meetup {self}"
                                print db.error or else "Null error"