Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented rating resources function (Fixes #269) #270

Closed
wants to merge 37 commits into from

Conversation

yaoxing1990
Copy link
Contributor

Implemented UI for user to submit rating:
capture

@yaoxing1990
Copy link
Contributor Author

Implemented UI with comment. Added updating to database feature. Every time the same user gives a new rating, the old rating will be updated.

@yaoxing1990
Copy link
Contributor Author

I want to extract route parameter in ngOnInit but once I insert code into it, once restart, the app fails launching. Is there anything wrong with this? @paulbert @lmmrssa @nirojdyola

 this.route.paramMap.pipe(switchMap((params: ParamMap) => {
      this.getResource(params.get('id'));
      this.id = params.get('id');
    }))
 .subscribe(resource => this.resource = resource);

@yaoxing1990
Copy link
Contributor Author

@lmmrssa @paulbert Finished implementing resource rating feature (#269)
For example, 1 female gave 2.6 points, 1 male gave 4.8 points, so there are 2 people rating, the average point is (2.6 * 1 + 4.8 * 1) / 2 = 3.7, 3.7 * 20% = 74%
capture2
capture1

@lmmrssa
Copy link
Member

lmmrssa commented Dec 25, 2017

@yaoxing1990 It seems you have added package-lock.json file, could you remove that? Also you have changed some of the package versions and added ts-lint on production. Please revert that as well.

@yaoxing1990
Copy link
Contributor Author

@lmmrssa Reverted

package.json Outdated
@@ -58,7 +58,7 @@
"protractor": "~5.1.2",
"request-promise": "^4.2.1",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"tslint": "^5.3.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why tslint is aded in package.json, its already been added you dont have to change it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@razu9861 I accidentally changed it form "~" to "^"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this change is not required for the given issue. The issue requires only rating function . So, you don;t have to change it. Could you revert it back ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirojdyola Reverted

})
export class ResourcesRateComponent implements OnInit {

ratingForm: FormGroup;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow tslint rule for indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package.json Outdated
@@ -58,7 +58,7 @@
"protractor": "~5.1.2",
"request-promise": "^4.2.1",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"tslint": "^5.3.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this change is not required for the given issue. The issue requires only rating function . So, you don;t have to change it. Could you revert it back ?

@@ -0,0 +1,45 @@
<h1 i18n>Submit your rating</h1>
<form [formGroup]="ratingForm" (ngSubmit)="onSubmit()">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove extra line ?

<mat-error><planet-form-error-messages [control]="ratingForm.controls.id"></planet-form-error-messages></mat-error>
</mat-form-field>
</div>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line please.

<mat-error><planet-form-error-messages [control]="ratingForm.controls.user"></planet-form-error-messages></mat-error>
</mat-form-field>
</div>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more extra line . Could you please remove all those ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -10,7 +10,10 @@ export class ResourcesComponent implements OnInit, AfterViewInit {
resources = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
displayedColumns = [ 'title', 'rating' ];
readonly dbName = 'resources';
readonly resourceDb = 'resources';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why readonly dbName = 'resources'; has been changed to readonly resourceDb = 'resources';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because another database named "rating" also exists, to avoid confusion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yaoxing1990
Copy link
Contributor Author

@lmmrssa Because during registration, user gender is not recorded, so currently the gender cannot be obtained, Also the new database not in installation script is still a issue

@lmmrssa
Copy link
Member

lmmrssa commented Dec 26, 2017

Error Received

 92% chunk asset optimization                                                 y <--- Last few GCs --->

  497502 ms: Mark-sweep 650.1 (1167.4) -> 449.3 (1143.4) MB, 3961.7 / 0.0 ms [allocation failure] [GC in old space requested].
  499260 ms: Mark-sweep 449.3 (1399.4) -> 449.1 (1343.4) MB, 1756.6 / 0.0 ms [allocation failure] [GC in old space requested].
  500839 ms: Mark-sweep 449.1 (1599.4) -> 446.9 (1450.4) MB, 1577.0 / 0.0 ms [last resort gc].
  502102 ms: Mark-sweep 446.9 (1450.4) -> 446.9 (1419.4) MB, 1262.9 / 0.0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2e04a07cf781 <JS Object>
    1: flatten_args(aka flatten_args) [0x2e04a0704381 <undefined>:~11681] [pc=0xc7593c3eb59] (this=0x2e04a0704381 <undefined>,fn=0x358135d93731 <an AST_Function with map 0x112ae206ce79>,scope=0x358135d95499 <an AST_Function with map 0x196f7e2b9a59>)
    2: /* anonymous */(aka /* anonymous */) [0x2e04a0704381 <undefined>:11627] [pc=0xc7593dd885f] (this=0x2e04a0704381 <undefined>,self=0x2e2f9f6e0...

FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
 1: node::Abort() [ng]
 2: 0x109f13c [ng]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [ng]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [ng]
 5: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [ng]
 6: v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char const*, char const*, v8::GCCallbackFlags) [ng]
 7: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [ng]
 8: v8::internal::Factory::NewStringFromOneByte(v8::internal::Vector<unsigned char const>, v8::internal::PretenureFlag) [ng]
 9: v8::internal::Factory::NumberToString(v8::internal::Handle<v8::internal::Object>, bool) [ng]
10: v8::internal::Object::ToString(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>) [ng]
11: v8::internal::Object::ConvertToName(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>) [ng]
12: v8::internal::LookupIterator::PropertyOrElement(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, bool*, v8::internal::LookupIterator::Configuration) [ng]
13: v8::internal::Runtime::GetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [ng]
14: 0xed4961 [ng]
15: v8::internal::Runtime_KeyedGetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [ng]
16: 0xc758e8092a7
Aborted

@paulbert
Copy link
Member

I had to force push a few updates because something strange happened where all of the previous commits on this PR were showing up as different from my local commits.

Before working on this you should delete your local branch (git branch -D rating-resource) then checkout again to get the branch on GitHub.

@yaoxing1990
Copy link
Contributor Author

@paulbert No problem. Is it caused by rebase? Laxman did rebase on this branch last night

@paulbert
Copy link
Member

paulbert commented Jan 7, 2018

Travis failing because it's taking too long to build...
image

@razu9861
Copy link
Contributor

@yaoxing1990 i have attatched images for rating please implement this, have a look at both images add a button for rating on second image while clicking buton it should show popup for ratng. please try to implement it
dashboard-v2v2 42-lib-layout-2b
screen shot 2018-01-11 at 10 01 33 am

@paulbert
Copy link
Member

Closing since this was incorporated with #321

@paulbert paulbert closed this Feb 12, 2018
@empeje empeje deleted the rating-resource branch April 10, 2018 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants