Skip to content

Commit

Permalink
0.56.0
Browse files Browse the repository at this point in the history
This closes #63 and closes #64
  • Loading branch information
coni2k committed Jun 12, 2016
1 parent 26d6124 commit 515c45e
Show file tree
Hide file tree
Showing 33 changed files with 819 additions and 841 deletions.
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/UserElementFieldIndexTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void NewUserElementFieldIndex_ShouldCreate()
.AddElement("Element")
.AddField("Field", ElementFieldDataType.Boolean, true)
.EnableIndex(ElementFieldIndexSortType.HighestToLowest)
.AddUserRating(user, 0);
.AddUserRating(0);
}
}
}
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/UserResourcePoolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public void NewUserResourcePool_ShouldCreate()
{
var user = new User("User", "user@email.com");
var resourcePool = new ResourcePool(user, "CMRP")
.AddUserResourcePool(user, 0);
.AddUserResourcePool(0);
}
}
}
25 changes: 10 additions & 15 deletions BusinessObjects/Models/ElementField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,33 +86,23 @@ public ElementField(Element element, string name, ElementFieldDataType fieldType

#region - Methods -

public UserElementField AddUserRating(User user, decimal rating)
public UserElementField AddUserRating(decimal rating)
{
// TODO Validation?
var userRating = new UserElementField(user, this, rating);
user.UserElementFieldSet.Add(userRating);

var userRating = new UserElementField(this, rating);
UserElementFieldSet.Add(userRating);
return userRating;
}

public ElementField EnableIndex()
{
ValidateEnableIndex();

IndexEnabled = true;
IndexCalculationType = (byte)ElementFieldIndexCalculationType.Aggressive;
IndexSortType = (byte)ElementFieldIndexSortType.HighestToLowest;
return this;
return EnableIndex(ElementFieldIndexCalculationType.Aggressive, ElementFieldIndexSortType.HighestToLowest);
}

public ElementField EnableIndex(ElementFieldIndexSortType indexSortType)
{
ValidateEnableIndex();

IndexEnabled = true;
IndexCalculationType = (byte)ElementFieldIndexCalculationType.Aggressive;
IndexSortType = (byte)indexSortType;
return this;
return EnableIndex(ElementFieldIndexCalculationType.Aggressive, indexSortType);
}

public ElementField EnableIndex(ElementFieldIndexCalculationType calculationType, ElementFieldIndexSortType indexSortType)
Expand All @@ -122,9 +112,14 @@ public ElementField EnableIndex(ElementFieldIndexCalculationType calculationType
IndexEnabled = true;
IndexCalculationType = (byte)calculationType;
IndexSortType = (byte)indexSortType;

AddUserRating(50);

return this;
}

// TODO Where is DisableIndex my dear?! / SH - 11 Jun. '16

void ValidateEnableIndex()
{
if (DataType == (byte)ElementFieldDataType.String
Expand Down
11 changes: 0 additions & 11 deletions BusinessObjects/Models/ResourcePool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,6 @@ public UserResourcePool AddUserResourcePool(decimal rate)
return userResourcePool;
}

[Obsolete("Try to switch to the method without user variable")]
public UserResourcePool AddUserResourcePool(User user, decimal rate)
{
// Todo Validation?
// var userResourcePool = new UserResourcePool(user, this, rate);
var userResourcePool = new UserResourcePool(this, rate);
user.UserResourcePoolSet.Add(userResourcePool);
UserResourcePoolSet.Add(userResourcePool);
return userResourcePool;
}

#endregion
}
}
4 changes: 1 addition & 3 deletions BusinessObjects/Models/UserElementField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ public class UserElementField : BaseEntity
public UserElementField()
{ }

public UserElementField(User user, ElementField elementField, decimal rating)
public UserElementField(ElementField elementField, decimal rating)
: this()
{
Validations.ArgumentNullOrDefault(user, "user");
Validations.ArgumentNullOrDefault(elementField, "elementField");

User = user;
ElementField = elementField;
Rating = rating;
}
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
### Changelog

**0.56.0**

* resourcePoolManage - Field rating edit
https://github.com/forCrowd/WealthEconomy/issues/64
* Find keep alive service
https://github.com/forCrowd/WealthEconomy/issues/63

**0.55.1**

* resourcePoolEditor.js - getResourcePoolExpanded - resourcePool undefined check was added
Expand Down
2 changes: 1 addition & 1 deletion SolutionItems/Documents/Todo.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
*** HOT ***

* field - rating edit in manage.html?
* cmrp list? -> search page
* content for editor? new content or new resourcepool - content in a content? or page as a new entity?
* route update (_system/)
* application manager - allows admin to update appSettings & restarts the app?
* 360 reasons to destroy - https://t.co/BHdHwjfSfR

* expand('User' - brings all user info ?!?!?
http://stackoverflow.com/questions/10781309/asp-net-mvc-4-webapi-manually-handle-odata-queries
Expand Down
2 changes: 1 addition & 1 deletion SolutionItems/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
//
// AssemblyFileVersion is not in use for the moment
//
[assembly: AssemblyVersion("0.55.1")]
[assembly: AssemblyVersion("0.56.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
6 changes: 3 additions & 3 deletions ngClient.Tests/entities/Commons.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference path="../../ngClient/js/lib/lib.js" />
/// <reference path="../../ngClient/_system/js/lib/lib.min.js" />
/// <reference path="../../ngClient/bower_components/angular-mocks/angular-mocks.js" />
/// <reference path="../../ngClient/js/app/app.js" />
/// <reference path="../../ngClient/js/appSettings/appSettings.js" />
/// <reference path="../../ngClient/_system/js/app/app.min.js" />
/// <reference path="../../ngClient/_system/js/appSettings/appSettings.js" />

function registerPrototypes($injector) {

Expand Down
2 changes: 1 addition & 1 deletion ngClient.Tests/entities/ElementCellTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('ng Cell', function () {
createUserCell(cell, 10);

// This has to be called manually in order to update the cached value
// In the application, this is done by updateElementCellNumericValue method under userService.js
// In the application, this is done by updateElementCellDecimalValue method under userService.js
cell.setCurrentUserNumericValue();

// Assert
Expand Down
20 changes: 20 additions & 0 deletions ngClient.Tests/entities/Sanity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe('ng Sanity', function () {

beforeEach(function () {
});

it('Pure', function () {

expect(0).toBe(0);

});

it('Experimental', function () {

// Just experimental
var number = 1000000000000000000000000000000000;
var total = number * number;
expect(total).toBe(total);

});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="Commons.js" />

describe('ng Sanity Checks', function () {
describe('ng Sanity Entities', function () {

var ResourcePool, Element, ElementField, ElementItem, ElementCell;

Expand All @@ -21,21 +21,6 @@ describe('ng Sanity Checks', function () {
});
});

it('Pure sanity', function () {

expect(0).toBe(0);

});

it('Experimental', function () {

// Just experimental
var number = 1000000000000000000000000000000000;
var total = number * number;
expect(total).toBe(total);

});

it('Entities', function () {

// Entities
Expand Down
3 changes: 2 additions & 1 deletion ngClient.Tests/ngClient.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
<Content Include="entities\ElementItemTests.js" />
<Content Include="entities\ElementTests.js" />
<Content Include="entities\ResourcePoolTests.js" />
<Content Include="entities\SanityTests.js" />
<Content Include="entities\Sanity.js" />
<Content Include="entities\SanityEntities.js" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
Expand Down
6 changes: 3 additions & 3 deletions ngClient/_system/js/app/config/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@

/* User */
.when('/:userName', { title: 'Profile', templateUrl: '/_system/views/account/profile.html?v=0.51.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/:userName/new', { title: 'New CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.55.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/:userName/:resourcePoolKey/edit', { title: 'Edit CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.55.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/:userName/new', { title: 'New CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.56.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/:userName/:resourcePoolKey/edit', { title: 'Edit CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.56.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/:userName/:resourcePoolKey', { title: 'View CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolView.html?v=0.49.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })

/* Otherwise */
Expand Down Expand Up @@ -78,7 +78,7 @@

locationHistory.createItem($location, $route.current);

dataContext.getCurrentUser()
dataContext.initializeCurrentUser()
.then(function (currentUser) {
if ($route.current.accessType !== 'undefined') {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@
logger = logger.forSource(controllerId);

var vm = this;
vm.currentUser = { Email: '', UserName: '' };
vm.currentUser = dataContext.getCurrentUser();

// Events
$scope.$on('dataContext_currentUserChanged', currentUserChanged);

_init();

function _init() {
dataContext.getCurrentUser()
.then(function (currentUser) {
vm.currentUser = currentUser;
});
}

function currentUserChanged(event, newUser) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@
var vm = this;
vm.cancel = cancel;
vm.isSaveDisabled = isSaveDisabled;
vm.currentUser = null;
vm.currentUser = dataContext.getCurrentUser();
vm.saveChanges = saveChanges;

// Get current user
dataContext.getCurrentUser()
.then(function (currentUser) {
vm.currentUser = currentUser;
});

/*** Implementations ***/

function cancel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
};
vm.cancel = cancel;
vm.changeUserName = changeUserName;
vm.currentUser = { UserName: '' };
vm.currentUser = { UserName: '' };
vm.externalLoginInit = $location.search().init; // For external login's
vm.isSaving = false;
vm.isSaveDisabled = isSaveDisabled;
Expand All @@ -25,16 +25,13 @@

function _init() {

dataContext.getCurrentUser()
.then(function (currentUser) {
vm.currentUser = currentUser;
vm.bindingModel.UserName = currentUser.UserName;
vm.currentUser = dataContext.getCurrentUser();
vm.bindingModel.UserName = vm.currentUser.UserName;

// Generate test data if localhost
if ($location.host() === 'localhost') {
vm.bindingModel.UserName = dataContext.getUniqueUserName();
}
});
// Generate test data if localhost
if ($location.host() === 'localhost') {
vm.bindingModel.UserName = dataContext.getUniqueUserName();
}
}

function cancel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,22 @@

function _init() {

dataContext.getCurrentUser()
.then(function (currentUser) {

vm.currentUser = currentUser;

if (!vm.currentUser.isAuthenticated()) {
return;
}

// If there is no token, no need to continue
var token = $location.search().token;
if (typeof token === 'undefined') {
return;
}

dataContext.confirmEmail({ Token: token })
.then(function () {
logger.logSuccess('Your email address has been confirmed!', null, true);
$location.url('/_system/account');
});
vm.currentUser = dataContext.getCurrentUser();

if (!vm.currentUser.isAuthenticated()) {
return;
}

// If there is no token, no need to continue
var token = $location.search().token;
if (typeof token === 'undefined') {
return;
}

dataContext.confirmEmail({ Token: token })
.then(function () {
logger.logSuccess('Your email address has been confirmed!', null, true);
$location.url('/_system/account');
});
}

Expand Down
43 changes: 20 additions & 23 deletions ngClient/_system/js/app/controllers/account/ProfileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,26 @@

function _init() {

dataContext.getCurrentUser()
.then(function (currentUser) {
vm.currentUser = currentUser;

// If userName equals to current user
if (userName === currentUser.UserName) {
vm.user = currentUser;
} else {

// If not, then check it against remote
dataContext.getUser(userName)
.then(function (user) {

// Not found, navigate to 404
if (user === null) {
$location.url('/_system/content/notFound?url=' + $location.url());
return;
}

vm.user = user;
});
}
});
vm.currentUser = dataContext.getCurrentUser();

// If userName equals to current user
if (userName === vm.currentUser.UserName) {
vm.user = vm.currentUser;
} else {

// If not, then check it against remote
dataContext.getUser(userName)
.then(function (user) {

// Not found, navigate to 404
if (user === null) {
$location.url('/_system/content/notFound?url=' + $location.url());
return;
}

vm.user = user;
});
}
}

function currentUserChanged(event, newUser) {
Expand Down
Loading

0 comments on commit 515c45e

Please sign in to comment.